ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Increasing alphabectically (https://www.excelbanter.com/excel-programming/436725-increasing-alphabectically.html)

HarryGuy

Increasing alphabectically
 
Windows XP and Excel 2003

The first time through the program should read:

With Active Sheet
.First = Sheets("Rates").Range("B2")
.Second = Sheets("Rates").Range("B3:B186")
End With

The next time through the Ranges should read "C2" and "C3:C186"

Then next time "D2" and "D3:D186" and so on until it reaches "X2"and
"X3:X186"

Can someone suggest a good way to do this. Please.





Barb Reinhardt

Increasing alphabectically
 
I'll give you what you need to answer your question, however some of your
syntax doesn't make sense. If you have other questions, come back.

Option Explicit

Sub test()

Dim myRange As Excel.Range
Dim r As Excel.Range

Dim myWS As Excel.Worksheet

Set myWS = Worksheets("Rates")
Set myRange = myWS.Range("B2:X2")

For Each r In myRange
Debug.Print r.Address
Debug.Print r.Offset(1, 0).Resize(184, 1).Address
'fill in what you want to do here.
Next r

End Sub
--
HTH,

Barb Reinhardt



"HarryGuy" wrote:

Windows XP and Excel 2003

The first time through the program should read:

With Active Sheet
.First = Sheets("Rates").Range("B2")
.Second = Sheets("Rates").Range("B3:B186")
End With

The next time through the Ranges should read "C2" and "C3:C186"

Then next time "D2" and "D3:D186" and so on until it reaches "X2"and
"X3:X186"

Can someone suggest a good way to do this. Please.




.


HarryGuy

Increasing alphabectically
 
Thanks very much to all who responded - very much appreciated.

"Barb Reinhardt" wrote in message
...
I'll give you what you need to answer your question, however some of your
syntax doesn't make sense. If you have other questions, come back.

Option Explicit

Sub test()

Dim myRange As Excel.Range
Dim r As Excel.Range

Dim myWS As Excel.Worksheet

Set myWS = Worksheets("Rates")
Set myRange = myWS.Range("B2:X2")

For Each r In myRange
Debug.Print r.Address
Debug.Print r.Offset(1, 0).Resize(184, 1).Address
'fill in what you want to do here.
Next r

End Sub
--
HTH,

Barb Reinhardt



"HarryGuy" wrote:

Windows XP and Excel 2003

The first time through the program should read:

With Active Sheet
.First = Sheets("Rates").Range("B2")
.Second = Sheets("Rates").Range("B3:B186")
End With

The next time through the Ranges should read "C2" and "C3:C186"

Then next time "D2" and "D3:D186" and so on until it reaches
"X2"and
"X3:X186"

Can someone suggest a good way to do this. Please.




.





All times are GMT +1. The time now is 04:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com