Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
If cell is not null, add value to adjecent cell
Hi all,
I have a spreadsheet which is automatically inported form a text file by VBA by the click of a button What I am trying to achieve (but failing miserably) is to build a loop statement that says, if cell x1 is not null then y1 = "hello!". This would then move on to x2 etc until it reaches a null cell which would then exit the sub. The tab will have mulitple records and I just cant seem to figure out the best (and quickest) automated way of doing it. Cheers for your help! Mav |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
If cell is not null, add value to adjecent cell
Sub changeValues()
Const NULLCOLUMNTOCHECK As String = "A" Dim iStartingRow As Long Dim iLastRow As Long iLastRow = Range(NULLCOLUMNTOCHECK & Rows.Count).End(xlUp).Row For iStartingRow = 2 To iLastRow If Range(NULLCOLUMNTOCHECK & iStartingRow).Value < "" Then Range(NULLCOLUMNTOCHECK & iStartingRow).Offset(0, 1).Value = "HELLO" Else Range(NULLCOLUMNTOCHECK & iStartingRow).Offset(0, 1).Value = "GOODBYE" End If Next End Sub "Maver1ck666" wrote: Hi all, I have a spreadsheet which is automatically inported form a text file by VBA by the click of a button What I am trying to achieve (but failing miserably) is to build a loop statement that says, if cell x1 is not null then y1 = "hello!". This would then move on to x2 etc until it reaches a null cell which would then exit the sub. The tab will have mulitple records and I just cant seem to figure out the best (and quickest) automated way of doing it. Cheers for your help! Mav |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Set cell value if adjecent cell value is greater than 0 | Excel Worksheet Functions | |||
If cell is not null, add value to adjecent cell | Excel Programming | |||
Change Validation list in the adjecent cell on the Basis of Value in the Current Cell | Excel Programming | |||
cell value based on null/not null in another cell | Excel Worksheet Functions | |||
cell shows 0 when referenced cell is null | Excel Worksheet Functions |