Help with Do Loop that names rows as ranges

F

fifthhorseman

Hi,

I am working on some code that will look at each row (starting at ro
2) and define the row by the value that is on the row in column 1
until the program gets to a cell that is blank, in which the loo
stops. Everything seems to be working except for one small part.
keep on getting Run-time error 1004: That Name is not valid.

The following is my code:

Private Sub cmdCatAddSyn_Click()
'Synchronize all pages with the new category
'IN PROGRESS

RCount = 2
Do Until Worksheets(1).Cells(RCount, 1).Value = ""
Worksheets(1).Rows(RCount).Name = Worksheets(1).Cells(RCount, 1)
RCount = RCount + 1
Loop
End Sub

The section of code that is always highlighted i
Worksheets(1).Rows(RCount).Name=Worksheets(1).Cells(RCount,1)

All help is appreciated, and thank you in advance
 
T

Tom Ogilvy

names can't have spaces and must being with a letter. The name also can't
be ambiguous in terms of being a cell reference (you can't create a name
like A10 for example, or R1 or C5).

If it is mostly working, I suspect the value in the cell is not a legal
name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top