Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

error "object does not support this property or syntax"

  Asked By: Gin    Date: Aug 29    Category: MS Office    Views: 628
  

i am a newbie to VBA. i am currently using VBA to perform simple
functions in excel.

i have written the following codes to copy a variable cell and paste it
to another variable cell. However, while debugging,
the "activesheet.paste" has an error "object does not support this
property or syntax". I am stuck as i do not know how to write it.


Worksheets("1").Cells(i, 8).Select
Selection.Copy
Application.CutCopyMode = False
Worksheets("1").Cells(i, 36).Select

ActiveSheet.Paste


Would anyone advise me on the correct codes to write?

Share: 

 

5 Answers Found

 
Answer #1    Answered By: Kim Coleman     Answered On: Aug 29

here is the problem
Worksheets("1").Cells(i, 8).Select
Selection.Copy
Worksheets("1").Cells(i, 8).Select
ActiveSheet.Paste
Application.CutCopyMode = False

 
Answer #2    Answered By: Burke Martin     Answered On: Aug 29

Here are a few observations about your code:

1. Worksheets("1") would only have ("1") if the name on the sheet tab is 1.
If you
want the first sheet, whatever it is named, use Worksheets(1) or
Sheets(1).
2. The arguments for Cells are Row, then Column. As written, your code would
copy
something from column H to column AJ in the same row. Is that what you
intended?
3. Most importantly, delete the line Application.CutCopyMode = False

 
Answer #3    Answered By: Rolando Reed     Answered On: Aug 29

Try this more effecient code next time

sheets(1).cells(i, 8).copy
sheets(1).cells(i, 8).paste

That is all that is needed. Note sheets(1) will point to worksheet 1 regardless
of the name.

 
Answer #4    Answered By: Luete Fischer     Answered On: Aug 29

k_l

Does it work without the line

Application.CutCopyMode = False

 
Answer #5    Answered By: Bodhi Smith     Answered On: Aug 29

Whoops the code should be...and yes it works without the
Application.CutCopyMode = False command

Sheets(1).Cells(i, 8).Copy
Sheets(1).Cells(i, 8).Select
ActiveSheet.Paste

 
Didn't find what you were looking for? Find more on error "object does not support this property or syntax" Or get search suggestion and latest updates.




Tagged: