Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Searching for blank cell and populating based on previous data

Good day,
I've spent a bit of time browsing for this subject, but I'm a still a little
unclear after reading some of the posts. What I am trying to accomplish via
a macro:

Given a layout (A, B, C... are the columns)
A B C D
Red Steel Rolled Packaged
Cast Bulk
Extruded Bulk

I am trying to figure out a macro which will recognize that cells A2, A3 are
blank and fill those particular cells with the previous given value (in this
case "Red"). The same for the cells B2, B3 filled with "Steel". Basically,
trying to fill in the blanks so that I can insert it into a database.

I've tried messing around with:

Dim Rcell as range
For Each Rcell in Range("A:A")
If Rcell.value = "" Then
Rcell = Rcell.offset(-1, 0)
Else
End If
Next

I am getting good results from that code, BUT I cannot figure out how the
macro will know to stop after it has run through all of my data. I'm only
working with a few hundred rows, but the number of rows is not consistent
with each report I'm trying to convert this way. The macro just keeps
running until it reaches row 65536. Any ideas? I thank you very much for
your time and any support you can provide.




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Searching for blank cell and populating based on previous data

See
http://www.contextures.com/xlDataEntry02.html


--
Regards Ron de Bruin
http://www.rondebruin.nl



"AZ Analog" wrote in message ...
Good day,
I've spent a bit of time browsing for this subject, but I'm a still a little
unclear after reading some of the posts. What I am trying to accomplish via
a macro:

Given a layout (A, B, C... are the columns)
A B C D
Red Steel Rolled Packaged
Cast Bulk
Extruded Bulk

I am trying to figure out a macro which will recognize that cells A2, A3 are
blank and fill those particular cells with the previous given value (in this
case "Red"). The same for the cells B2, B3 filled with "Steel". Basically,
trying to fill in the blanks so that I can insert it into a database.

I've tried messing around with:

Dim Rcell as range
For Each Rcell in Range("A:A")
If Rcell.value = "" Then
Rcell = Rcell.offset(-1, 0)
Else
End If
Next

I am getting good results from that code, BUT I cannot figure out how the
macro will know to stop after it has run through all of my data. I'm only
working with a few hundred rows, but the number of rows is not consistent
with each report I'm trying to convert this way. The macro just keeps
running until it reaches row 65536. Any ideas? I thank you very much for
your time and any support you can provide.






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
Populating a cell based on combobox data mrdata[_31_] Excel Programming 0 July 18th 06 10:29 PM
Populating fields based on previous column values MMH Excel Programming 3 May 11th 05 09:18 PM
How would I fill blank cells with the data from a previous cell? Clive Darling Excel Discussion (Misc queries) 3 January 6th 05 01:10 AM
Data searching based on cell contents using VBa Craig Easton Excel Programming 1 November 25th 04 05:19 AM
Populating blank cells with the data in the cell above. Frank Kabel Excel Programming 0 August 2nd 04 04:23 PM


All times are GMT +1. The time now is 08:15 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"