Repeating Macro operations

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to know the easiest way to have a macro repeat its operation until the user ends it, or put a maximum number of iterations on it

I have a column of numbers, and I want to edit, add a zero as the first character, make the entry a text entry,save the entry, drop down one row, and repeat the processon the next number. I have about 2500 rows of numbers in the column.

In Lotus 1-2-3 it was EASY with the BRANCH /(letter) function. I hav'nt seen or heard of an equivalent easy solution with Excel

Can anyone help? Thank you.
 
Hi John
maybe something like
sub foo()
dim rng as range
dim cell as range
set rng = activesheet.range("A1:A2500")
For each cell in rng
if cell.value<>"" then
cell.value = "0" & cell.value
end if
next
end sub
 
John,

Although not what you asked, if you're trying to pad out a number with
zero's a way is to format the cell with a custom format set to x number of
zeros. I often use this to display 6 digit customer account numbers: under
Format, Cells, Number, select Custom as the category and enter 000000 in the
Type box.

Regards, Rob

John McAvoy said:
I want to know the easiest way to have a macro repeat its operation until
the user ends it, or put a maximum number of iterations on it.
I have a column of numbers, and I want to edit, add a zero as the first
character, make the entry a text entry,save the entry, drop down one row,
and repeat the processon the next number. I have about 2500 rows of numbers
in the column.
In Lotus 1-2-3 it was EASY with the BRANCH /(letter) function. I hav'nt
seen or heard of an equivalent easy solution with Excel.
 
Back
Top