2

I have an issue with the following VBA code:

Set timeRange = ActiveSheet.Cells.Find("DATE", MatchCase:=True) 'Cerca TIME column
 If timeRange Is Nothing Or Empty Then GoTo errorOpenColumn
 timcol = timeRange.Column
 Columns(timcol).Select
 Selection.NumberFormat = "yyyymmdd"
 Selection.Copy
 'Workbooks(Mainbook).Activate
 'Worksheets("Office_Data_Table").Select
 Workbooks(Mainbook).Activate
 Worksheets("Office_Data_Table").Activate
 Range("A:A").Offset(6, 0).PasteSpecial 'Error aqui
 Windows(Sourcebook).Activate

At the time it executes it will give an error in line Range("A:A").Offset(6, 0).PasteSpecial, but would not give an error (No valid entry. Application will be closed); but if I apply the Offset(0,6) it will work.

Obviously my problem is that I want to apply the Offset (6,0), and not the other one :-).

Any help highly appreciated.

1

1 Answer 1

2

Range("A:A") selects the whole column - and OFFSET(6,0) tries to offset the whole column down - which is not possible as it's already completely selected! Instead, you might want to use Range("A1"). Offset(6,0) or Range("A7") directly.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.