Out of range problem - I'm stumped...

E

Eric_G

I keep getting the 'out of range' error and I'm stumped.

Here is my code:
Workbooks("Performance-Oct-09.xlsm").Worksheets("SerU").Activate

'Copies range of master formula cells to appropriate range in worksheet to
match row of "End_Benchmark" date
With Sheets("SerU")
.Range("c1:h1").Copy _
Destination:=.Range("c" & .Range("b1"))

- the program stops at the "With Sheets("SerU") command, inferring that
there is no worksheet named "SerU" -- BUT THERE DEFINITELY IS.... I'm
stumped...
I'm trying to copy some cells from row 1 to a row further down and this code
works elsewhere in the macro. Any ideas??? tks
 
R

Rick Rothstein

First thought is that the sheet named SerU might have a space after (or
could be before) the text making up its name.
 
F

FSt1

hi
does the first line of your code activate sheet SerU??
if so, i doubt that the problem is with the line of code indicated. it may
be something in the with clause.
i test you code as posted and all worked as expected so i'm stumped also.
if you have activeated the sheet SerU then you don't really need the with
clause (unless there is alot more to it).
try the copy line with out the with clause....
Sub testit()
Sheets("SerU").Activate
Range("c1:h1").Copy _
Destination:=Range("c" & Range("b1").Value)
End Sub

......and see if another error pops up somewhere else.
ie troubleshoot mode.

best answer i can give without see all the code and maybe playing with it.

Regards
FSt1
 

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