Reg. Strings in for loops

jonastjader

New Member
Joined
Dec 9, 2013
Messages
12
Hi,
I want to make the string variable j go through different strings (to assign different Cells columns such as "A" or "B"). With integers it is easy:
Dim i As Integer
For i = 1 To 24

But how can I do a similair thing with strings? Or maybe assign so that 1,2,3 will be converted to A,B,C inside the for loop?
Dim j As String
For j = "A" To "C"
This does not seem to work...

Best,
Jonas
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hi,
I want to make the string variable j go through different strings (to assign different Cells columns such as "A" or "B"). With integers it is easy:
Dim i As Integer
For i = 1 To 24

But how can I do a similair thing with strings? Or maybe assign so that 1,2,3 will be converted to A,B,C inside the for loop?
Dim j As String
For j = "A" To "C"
This does not seem to work...

Using an modification of the method I posted to your other thread (where you asked this question for the numbers 1 thru 24) here...

http://www.mrexcel.com/forum/excel-...values-help-integer-variable.html#post3682418

this is how I would do it...

Code:
Sub ForLoop3()
  Range("A1:A24") = Evaluate("IF(ROW(),CHAR(64+ROW(1:24)))")
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,734
Messages
6,126,544
Members
449,316
Latest member
sravya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top