Object Required

SBF12345

Well-known Member
Joined
Jul 26, 2014
Messages
614
Greetings,

I am receiving an object required error on the following line:

Code:
COM.Worksheets(AC).Range(Cells(j, Column.End(xlToRight) + 1)).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

Other applicable lines include the following:

Code:
AC = ws.Name

Code:
Dim AC As String

Code:
Set COM = Workbooks("COMM_COMBINED.xls")

j is an integer.

I am not concerned with the column value used to identify the range object so long as the final result allows for the selection of a cell all the way to the right of the consumed adjacent row cells plus one more column over.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Deleted as confused by the OP's syntax and not looking at the other posts to try and work it out.
 
Last edited:
Upvote 0
This post is unrelated in terms of subject matter and does not violate the rules as I am understanding them. I believe it is correct to start a new thread, though I may be wrong. See Rules #12 https://www.mrexcel.com/forum/board-announcements/99490-forum-rules.html

In trying to run the script I am now receiving an "invalid qualifier" error on the following line changes included:

Code:
COM.Worksheets(AC).Range(Cells(j.End(xlToRight) + 1)).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
 
Last edited:
Upvote 0
SBF12345, can you please post sufficient code so that we can see what you're trying to do?

It's not at all clear from the incorrect syntax of the one line that's causing problems.
 
Upvote 0
I ended up writing it differently. It runs slower, but it works and time isn't a huge factor here. This is what I came up with:

Code:
COM.Worksheets(AC).Activate            Cells(j, 1).Select
            Selection.End(xlToRight).Offset(0, 1).Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

@ StephenCrump the invalid qualifier error was due to the contents of the Cell property and the j there was an integer variable of the j = j+1 loop type. The chunk is part of a loop structure.
 
Upvote 0
I am glad you got your syntax sorted.

Your code will run faster if you avoid .Activate and .Select:

Code:
COM.Worksheets(AC).Cells(j, Columns.Count).End(xlToLeft).Offset(, 1).PasteSpecial Paste:=xlPasteValues
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top