Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How do I Advancing to next column/cell in a Sheet.range(x)?

I have the following Macro and it works well untill I try to rename the
2nd sheet. I need to advance to the next Column (Example: B1 , C1, D1
....) in my Sheet(2).Range("X"). Is there anyway to do this? If so,
How?

Thanks,
Randy


Sub Macro 1
'
Dim nFloors
Dim nCount
Dim i
Dim nSheet

nCount = Sheets(1).Range("B26")
For i = 1 To nCount
nSheet = Application.Sheets.Count

If i = nFloors Then
End
End If
Application.ScreenUpdating = False

Sheets(3).Copy After:=Sheets(nSheet)
ActiveSheet.Name = "Floor " & Sheets(2).Range("B1")

Next i
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default How do I Advancing to next column/cell in a Sheet.range(x)?

With your current code the easiest would be to use i as your offset something
like this...

ActiveSheet.Name = "Floor " & Sheets(2).Range("B1").offset(0, i-1).value

As a complete aside you should be declaring your variable types. All of your
variables are of type variant which is very inefficient. If you are unsure
what I mean check out this site...

http://www.cpearson.com/excel/variables.htm
--
HTH...

Jim Thomlinson


"RandyR" wrote:

I have the following Macro and it works well untill I try to rename the
2nd sheet. I need to advance to the next Column (Example: B1 , C1, D1
....) in my Sheet(2).Range("X"). Is there anyway to do this? If so,
How?

Thanks,
Randy


Sub Macro 1
'
Dim nFloors
Dim nCount
Dim i
Dim nSheet

nCount = Sheets(1).Range("B26")
For i = 1 To nCount
nSheet = Application.Sheets.Count

If i = nFloors Then
End
End If
Application.ScreenUpdating = False

Sheets(3).Copy After:=Sheets(nSheet)
ActiveSheet.Name = "Floor " & Sheets(2).Range("B1")

Next i
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How do I Advancing to next column/cell in a Sheet.range(x)?

Jim,

Thanks! That worked perfect.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel automaticly advancing copied cell numbers Amazon H. Excel Worksheet Functions 5 August 18th 07 05:01 AM
Excel automaticly advancing copied cell numbers Max Excel Worksheet Functions 1 August 17th 07 01:54 AM
Advancing to the next cell Conan Kelly Excel Programming 1 July 22nd 05 03:30 AM
Copy Cell or Column without advancing formula reference? sgluntz Excel Discussion (Misc queries) 1 March 17th 05 07:13 PM
automatic cell advancing Marc Excel Programming 1 October 28th 04 03:21 PM


All times are GMT +1. The time now is 06:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"