Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
Can an If statement answer an If statement? M.A.Tyler Excel Discussion (Misc queries) 2 June 24th 07 04:14 AM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM


All times are GMT +1. The time now is 10:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"