VB Macro: How to create a loop to change a number in cell

  • Thread starter Thread starter Alex
  • Start date Start date
A

Alex

I hope this is an easy one ...

I have three cells and a macro application.

A1 is the starting number i.e. 2
A2 is the ending number i.e. 10
Macro application imports data based on A3

I want the macro to change the cell in A3 to 2, run macro
to import, change cell in A3 to 3, run macro to import,
4 ... 10. So I want to be able to type in any numbers in
A1 and A2 to tell the macro what to import.

Any help would be appreciated!
 
dim ictr as long
with worksheets("sheet1")
for ictr = .range("a1").value to .range("a2").value
.range("a3").value = ictr
call yourproceduretoimport
next ictr
end with

(I didn't do any validation)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top