Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
If then statement
I'm new to using if then statements, but I think that is what I need to
accomplish this task. Here is my situation. I download a report everyday that has thousands of rows and the row count changes each day. In an unknown number of rows, column G is empty and the data I need to move into Column G is in Column K. So I guess what I need is something that would say If in any row G is empty and if there is data in that row in column K, move that data in column K to column G. Is this even possible? Thanks so much. I plan on putting this code in Macro1 with my page setup code. Thank you |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
If then statement
This macro has the IF statements that you requi
Sub spackle() Dim r As Range, nLastRow As Long Set r = ActiveSheet.UsedRange nLastRow = r.Rows.Count + r.Row - 1 For l = 1 To nLastRow If IsEmpty(Cells(l, 7).Value) Then If Not IsEmpty(Cells(l, 11).Value) Then Cells(l, 7).Value = Cells(l, 11).Value End If End If Next End Sub -- Gary's Student "SITCFanTN" wrote: I'm new to using if then statements, but I think that is what I need to accomplish this task. Here is my situation. I download a report everyday that has thousands of rows and the row count changes each day. In an unknown number of rows, column G is empty and the data I need to move into Column G is in Column K. So I guess what I need is something that would say If in any row G is empty and if there is data in that row in column K, move that data in column K to column G. Is this even possible? Thanks so much. I plan on putting this code in Macro1 with my page setup code. Thank you |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
If then statement
"Gary''s Student" wrote in message
news:6A3C42A4-BB2A-4CA1-BC8A- nLastRow = r.Rows.Count + r.Row - 1 Does r.Row always return the row number of the first row in range r? I didn't know that! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF statement inside a SUMIF statement.... or alternative method | Excel Worksheet Functions | |||
Reconcile Bank statement & Credit card statement & accounting data | Excel Worksheet Functions | |||
Embedding an OR statement in an IF statement efficiently | Excel Discussion (Misc queries) | |||
Can an If statement answer an If statement? | Excel Discussion (Misc queries) | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions |