Help Retrieving Cell Values

  • Thread starter Thread starter Marshall
  • Start date Start date
M

Marshall

I need some help with the code I am trying to write.

I am trying to loop down the rows, each time checking to see if the
first column is empty. If it is then I want to add a formula to
another cell, and loop again.

I'm not new to programming, but am new to VB (although I have done some
tutorials), and am having some problems figuring out how to select the
cell and then check to see if the value is empty.

This is the code that I have so far, as maybe it will help if you are
having trouble understanding what I am trying to accomplish.


Dim I As Integer
I = 0
Do While "" = Worksheets("Sheet1").Range(Cells(I, 1)).Formula
ActiveCell.FormulaR1C1 = WS10_Formula
ActiveCell.Offset(1, 0).Range("A1").Select
I = I + 1
Loop


Thanks!



PS If you know of any decent free tutorials that you could link me to
that would be great :)
 
Marshall,

This worked in Excel 97

It defines the blank cells in column A and puts a formula in column 2 (B)
Change the destination column and formula to match your needs.

Dim rng As Range, cel As Range
'
Set rng = Columns("A:A").SpecialCells(xlCellTypeBlanks)
For Each cel In rng
cel.Offset(0, 2).Formula = "=a1+b2"
Next
 
Back
Top