Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 :) ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 -- sb "Marshall" wrote in message ... 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 :) ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Retrieving values from another sheet | Excel Worksheet Functions | |||
Retrieving Values from Cell with Macro | Setting up and Configuration of Excel | |||
Help with Comparing values and retrieving values in Excel!!!!!! | Excel Worksheet Functions | |||
Retrieving values from a specified sheet of a different file. | Excel Worksheet Functions | |||
retrieving values from a specified sheet | Excel Worksheet Functions |