Thread: VBA Problems
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Elise148 Elise148 is offline
external usenet poster
 
Posts: 43
Default VBA Problems

Thanks Peter...That seemed to work...at least, for now it's working... :)

" wrote:

On Jul 2, 1:36 pm, Elise148
wrote:
I'm trying to copy a worksheet and move and rename it to the end of the
workbook. This is the VBA code I have...

Sheets("201").Select
N = Sheets.Count
Sheets("201").Copy After:=Sheets(N)
ActiveSheet.Name = InputBox("Enter the number of the new distributor.")

It works for several times, but then an error comes up and it highlights the
third row. I don't understand! Any ideas?!?!?


What is the error message? I suspect since you are renaming
ActiveSheet you are actually renaming your source sheet by mistake.

Try:
Sheets("201").Copy After:=Sheets(sheets.count)
sheets(sheets.count).name = InputBox("Enter the number of the new
distributor.")

Peter