S
Sachin
Hey everyone.
I am trying to create a pretty simple macro in Excel. I have a decent
amount of experience with VBA, but very limited amount with
userforms.
I won't bore you guys with the details of my macro, so I'll just cut
to the chase. Basically, I have the userform set up with two text
boxes for input. The user is supposed to input a starting cell index
and an ending cell index, to indicate the range of cells that the
program needs to work with. For example, if the user entered "A14" in
the first box and "A43" in the second, the range would be "A14:A43".
My code then loops through the given range and executes other
commands. Here is my loop structure:
For Each cell In Range("A14:A43")
.....
Next cell
All the inner commands work fine and I can hardcode the range in to
get perfect results (as shown above), I just want to add the GUI for
efficiency. That way I wouldn't have to change the code every time the
range changes. I have stored both inputs as strings, but I can't
substitute the variable names for indexes. I can't find a procedure
for doing this anywhere else, but I'm sure this is a pretty common
task so I am probably just not querying the right things.
Any help would be greatly appreciated.
Thanks in advance.
I am trying to create a pretty simple macro in Excel. I have a decent
amount of experience with VBA, but very limited amount with
userforms.
I won't bore you guys with the details of my macro, so I'll just cut
to the chase. Basically, I have the userform set up with two text
boxes for input. The user is supposed to input a starting cell index
and an ending cell index, to indicate the range of cells that the
program needs to work with. For example, if the user entered "A14" in
the first box and "A43" in the second, the range would be "A14:A43".
My code then loops through the given range and executes other
commands. Here is my loop structure:
For Each cell In Range("A14:A43")
.....
Next cell
All the inner commands work fine and I can hardcode the range in to
get perfect results (as shown above), I just want to add the GUI for
efficiency. That way I wouldn't have to change the code every time the
range changes. I have stored both inputs as strings, but I can't
substitute the variable names for indexes. I can't find a procedure
for doing this anywhere else, but I'm sure this is a pretty common
task so I am probably just not querying the right things.
Any help would be greatly appreciated.
Thanks in advance.