LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default If Statement to fill in column to last row

Frequent (large) downloads, into Excel, requires the addition of a column,
that is filled by the use of an "IF" statement.

The following If statement works fine, when tested.
How to get it to work thru all cells, to last row.

Dim lastRow As Long
lastRow = Worksheets(1).Cells(Rows.Count, "C").End(xlUp).Row
Range("F2").AutoFill Destination:=Range("F2:F" & lastRow)

If Range("C2") = "S" Or Range("C2") = "B" Then
Range("F2").Value = Range("D2").Value
Else
Range("F2") = 0
End If
End Sub

If there is a better, more efficient way, please also advise............
 
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
Fill Color If Statement Elgee Excel Worksheet Functions 3 August 5th 08 10:13 PM
How to fill a cell using an IF statement Rudi Excel Discussion (Misc queries) 1 April 25th 08 10:55 AM
How do you Control the fill color using an if statement formula? RussCrowder Excel Worksheet Functions 2 June 1st 07 09:31 PM
How to fill a column with color in statement anamarie30 Excel Programming 3 April 2nd 07 03:52 PM
Fill an Indirect Statement D Excel Discussion (Misc queries) 4 November 20th 06 07:21 PM


All times are GMT +1. The time now is 02:58 AM.

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

About Us

"It's about Microsoft Excel"