views:

87

answers:

4

I need to move a row of data to another worksheet when a user chooses a value in a listbox. I am trying to use the following code to select the row on the new worksheet I want to move the data to:

'Move data to the "Red" worksheet
Sheets("Red").Range ("A11").Select

I am getting an "Object does not support this property or method" error.

What am I doing wrong?

A: 

As long as you have a sheet called Red, and it is visible, your code should work.

Make sure that the sheet is displayed by calling

Sheets("Red").Select

first.

Peter Lang
A: 

Use the macro recorder and manually perform the operation you want. Then you can look at the code recorded by Excel and clean it up to suit your needs.

The macro recorder is the easiest way to figure out whatever convoluted syntax VBA wants you to use.

Stewbob
A: 
  1. Is selecting allowed on your sheet? (= selection not prohibited by protection)
  2. I have noticed a space character between the word Range and ("A11"). This might have caused a syntax error.
Jerry
+1  A: 

There should NOT be a space between "Range" and "(".

iDevlop