Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Prefill column

I guess I should point out why I said my solution "should be pretty
speedy"... the difference between my loop and the others that have been
posted so far is the number of iterations that will be performed. For your
posted example data, the macro I posted will iterate 3 times (once for each
blank area) whereas the other solution's loops will iterate 9 times (once
per cell). I would also note that my calculation for the LastRow does not
require you to know in advance which column will contain the row with the
last piece of data in it... my code finds the last filled row of data no
matter what column it is in.

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
This macro should be pretty speedy...

Sub FillInTheBlanks()
Dim Area As Range, LastRow As Long
Const ColLetter As String = "A"
On Error Resume Next
LastRow = Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlFormulas).Row
For Each Area In Columns(ColLetter)(1).Resize(LastRow). _
SpecialCells(xlCellTypeBlanks).Areas
Area.Value = Area(1).Offset(-1).Value
Next
End Sub

--
Rick (MVP - Excel)


"SITCFanTN" wrote in message
...
Below is a sample of the data I download to a spreadsheet. I need to
write a
macro to fill in the empty cells in column A with the data from the
previous
cell in the column with data. I know I didn't explain that well but in
the
example below, I need TF48 to fill in Col A for rows 3,4 & 5. Then T16A
would fill in row 7 and T505 in row 9 and 10. I hope I've explained this
sufficiently. Thanks in advance for your help.

1 A B C D
2 TF48 $100.00 ABC 20091116
3 $ 50.00 DTR 20091116
4 $ 25.00 PLO 20091116
5 $ 75.00 FRD 20091116
6 T16A $100.35 UYE 20091116
7 $124.55 PLE 20091116
8 T505 $109.00 REW 20091115
9 $876.90 JLO 20091113
10 $234.90 REW 20091116



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
Cell validation prefill Sue Excel Discussion (Misc queries) 2 April 9th 08 09:24 PM
Prefill a text box on a form Mike H. Excel Programming 2 August 17th 07 04:46 PM
How can I prefill a text field with leading 0s? Sweetetc Excel Worksheet Functions 4 February 24th 06 07:04 PM
Prefill cust info from drop list into other cells carris76 Excel Worksheet Functions 2 May 28th 05 07:28 PM
How do I convert dollars and cents to text, and prefill the cell . Jan Buckley Excel Worksheet Functions 1 January 20th 05 07:22 PM


All times are GMT +1. The time now is 09:00 PM.

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"