Loops

  • Thread starter Thread starter PaulSinki
  • Start date Start date
P

PaulSinki

Hi, I was hoping that someone might be able to help me.
I have a list of data that can change in length in terms of rows, but I
want to have a macro that will paste a formula into the adjacent cell
for every non-blank cell within the data set.
ie Column B has 84 rows this time, I want to put a formula in Column C
for the matching number of rows, but when I run the macro next time, I
want it to be able to do the same thing if there is 90 or 40 rows in
Column B.
Any help greatly appreciated!
Thanks,
Paul
 
you can try something like
For row =1to 65000
your code goes here

If cells(row,2)="" then exit sub
next row

good luck
 
Define column B as a Range
ColumnB.Select
Dim Cell As Range
For Each Cell In Selection
If cell. value ="" then Cell.offset(0,1).value =
etc...
Next Cell

Should work
 
Dim rng as Range
set rng = Range(Cells(1,2),Cells(1,2).End(xldown))
rng.offset(0,1).Paste
 
Back
Top