Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Excel


VBA To Fill Blank Cells

I have two columns with data (length of column B represents total length of database.) Column A only has some blank cells.

I need to fill Column A blanks with the contents of cell above.

[blank cell]
[blank cell]
[blank cell]
***end of column B

Therefore VBA to place Tuesday into blank and Thursday into the two blanks before bottom of the range of Column B.

Using record macro doesnt give me go to first blank etc.

something like

Start column A2 to End
Find first blank, copy active cell -1
Next blank cell. (ins some cases it will copy the name it has just filled into cell above.
Finish at last cell in Comumn B

View Complete Thread with Replies

Sponsored Links:

Related Forum Messages:
Fill In Blank Cells Referencing Non-Blank Cells Above
I have sporadic cell values in a column. I will be describing the lamen logic I use to fill in these blanks manually. Find the first nonblank cell in the column, then look for the next nonblank cell in the column. I count the number of blank cells in between. If even # of blank cells, then I give the first half of the blanks the value of the first nonblank cell and the second half of the blank cells the value of the next nonblanck. If odd # of blank cells, then I do the same with the exception that the odd cell that falls in the middle will be randomly designated the value of the either first or second nonblank cell.

View Replies!   View Related
Fill Blank Cells Going Up
Is there any way to fill blank cells going up instead of down, other than having to go to each section and dragging the fill handle. I'm looking at a list of data that has a summ code at the bottom of each section of data. I need to fill the blank cells above the summ code for each section.

For example:

D2-NHL RACE .001515

A0-ATBV TRIO DV .018989
C0-ATBV C HN .017676
C0-ATBV C HNAC .0011

43-ATBETRIOHN .014646

Everything above NV needs to be filled with NV and everything aboveNH needs to be filled with NH. There are over 13000 lines of data. How do I accomplish assigning or filling the related summ codes in the blank cells in between?

View Replies!   View Related
Fill Blank Cells In Range
I have a set of integers in the ranges of: B11 to B40, C11 to C40, D11 to D40.

Occasionally the values in the cells are deleted and thus left as a "blank" cell.

I wish to create a macro that will find these blank cells in these ranges and replace them with a simple 0.

View Replies!   View Related
Macro To Fill Blank Cells
I wonder if soeone could change the following macro so that the bottomcell
is set to be as far down as there is content in Column "A". As it stands if I fill in blank cells in Column "C" and the last cell with data is say C10 it does just this. But if the actual last row with data in column "A" is A14 then cells C11, C12, C13, and C14 are ignored. C11, C12, C13, and C14 should be the same as C10 above them.

Sub FillBlankCells()
Dim topcell As Range, bottomcell As Range
Set topcell = Cells(1, ActiveCell.Column)
Set bottomcell = Cells(16384, ActiveCell.Column)
If IsEmpty(topcell) Then Set topcell = topcell.End(xlDown)
If IsEmpty(bottomcell) Then Set bottomcell = bottomcell.End(xlUp).Offset
Range(topcell, bottomcell).Select
Selection.FormulaR1C1 = "=R[-1]C"
End Sub

Other macros recognize the actual last row.... but have issues with columns formatted as Text. The macro above doesn't create problems with columns formatted as "Text".

View Replies!   View Related
Fill Blank Cells Within Column
If A1 has a value of ABC,
A2-A5 are blank
A6 has a value of DEF
A7-A10 are blank.
Is there a formula that will fill A2-A5 with ABC,
look at the value of A6 and see that it is different from A1-A5,
or not blank,
change the fill value to the new value, A6,
then fill down the value of A6 into A7-A10
instead of manually using the fill handle?

View Replies!   View Related
Fill Blank Cells From Cell Above
I am trying to fill down data in columns A:C but only if there is data in column D. I have butchered VBA into this working bit but the fill down stops too early.

Sub fillall()
Set x = Worksheets("Paste"). Range("A3", "c3")
Range(x, x.End(xlDown).Offset(-1, 0)).filldown
Set x = Range(x.End(xlDown), x.End(xlDown).Offset(0, 2))
Loop Until x.End(xlDown).Offset(0, 3) = 0
End Sub

View Replies!   View Related
Fill In Blank Cells After Grouping Subtotal
I just did a Group Subtotal. How do I fill all the blank cells in a column with the information in the cell above it without going to every individual cell?

View Replies!   View Related
Fill Blank Cells In Column Range
How do I make this to work with dynamic range instead running for complete column? For example: Run this code until last active cell in Column A. Column A will always has value so if cell A25 is last active cell in range then this code should stop executing for column R25. So execution of this code would depend on active cell in column A.

Dim Cell As Range
For Each Cell In Selection.Cells
If Cell.Value = True Then ' if true do nothing
Cell.Value = ""
ElseIf Cell.Value = False Then ' if false change to Null
Cell.Value = "Null"
End If

View Replies!   View Related
Fill Blank Cells With Data On Left
I have a macro that creates mutiple, though varing numbers of, columns. Once the columns are created, a blank column is set up to the right of them. When the data is ideal, only one cell in each row created by the populated columns will have data in it. So lets say that in this example, the macro created 23 columns of data. A1 is blank, B1 is Widget, and C1 through the end are also blank. I need a macro that will look at the rows and find the populated column and copy that string of data to the blank 24th column (to the right) created after the poulated columns. So X1 (the 24th column) will have Widget placed in it.

Now I need it to do one other thing. In another example, let say there are 5 columns created this time. In the third row, there is data in A3 and D3. If they are the equal to each other (A3 value being 143256 and D3 value being 143256), then I need the 6th column created to have 143256 placed in it. However, if the data differs ( A3 value being 143255 and D3 value being 143288) then I need the word "Scrap" to appear in the sixth column.

View Replies!   View Related
Can I Fill Non-adjacent Cells With The Fill Feature? (example Listed)
how to enter data in non-adjacent cells using a fill command.

Here is what I am trying to do:
in the column, I am holding ctrl button to select every 10th cell down the sheet. I need to enter a date in every selected cell that is exactly 7 days apart, i.e., 11/7/08 then 11/14/08 then 11/21/08, etc.... but no other dates or data.

I have tried to figure out a way to do this other than manually, but am confounded.

View Replies!   View Related
Fill With Blank Spaces
I have a worksheet where the user input data and i have to make a macro that exports certain cell from the worksheet to a text file without any separating symbol, just like “CONCATENATE and EXPORT”. This is not hard to do, i’ve done it already. But the difficult part is here. My customer wants this macro to be interactive with the user and with an AS400 server that takes the textfile and reads it to find the value of certain variables, something like the opposite process of CONCATENATE. The hard part for me is that if any of the cells concatenated is blank i have to fill the text file with blank spaces.

If the concatenated cells are:
|one| two| three| tour| five|

the exported text to the text file will be:


But if one of the cells is blank:..................

View Replies!   View Related
Fill With (blank) When No Data Found
Fill with (blank) when no data found
I have the following data lets say:

View Replies!   View Related
Repeat Cell Above (fill Blank)
I have a worksheet with a column with words, but a lot od the cells are empty. I want these replaced with the word above. I know I can do this with fill handle, but as there are thousands, it would help with a routine - a program - that I could run on the column and thus fill out all the empty cells.

View Replies!   View Related
Conditional Fill-Down Until Next Blank Cell
I need to automate a conditional fill down in excel. I have a sheet, some of the columns have rows of empty cells (the amount of empty cells varies). Whenever there is an empty cell I need to fill down, however when a new value is encountered that must then be filled down and so on. This bit I have as:

Set rngWBSv1 = Range("c2", Range("c65536").End(xlUp))
For Each clWBSv1 In rngWBSv1
If clWBSv1.Value = "" Then clWBSv1.Value = clWBSv1.Offset(-1, 0).Value
Next clWBSv1

Set rngWBS2 = Range("d2", Range("d65536").End(xlUp))
For Each clWBS2 In rngWBS2
If clWBS2.Value = "" Then clWBS2.Value = clWBS2.Offset(-1, 0).Value
Next clWBS2 ......................

View Replies!   View Related
Fill Blank Rows With Formulas
I want to copy an active cell in row 2 (I dont want to fix a cell as it can be any cell at any time). I want to copy it all the way down to a cell where the next row after it, is completely blank on all the 256 cells.

View Replies!   View Related
Fill Formula To Last Blank Cell In Column
I have a formula


I need a macro to copy this to the last blank cell in the column, the last blank cell will be different each month otherwaise i would have just been able to enter a range L2:L6000.

View Replies!   View Related
Find Blank Cell Then Fill Column With Data
I have a userform that I am using to populate a column with data. I have the following code to find the next blank cell on the first row to enter the data from the first textbox in the userform

ActiveSheet.Range("av1").End(xlToLeft).Offset(0, 1).Value = TextBox1

I was then going to populate the rest of the cells in the column by changing the range "A1" to "A2" and so on. The problem I have is that not all of the cells have a compulsory entry so when the end(xlToLeft) function may not always end in the same column and the data will be staggered.

First Entry

Second Entry

What I want to do is find the first blank cell in the first row, as that will have a compulsory entry, and then fill the rest of the cells in the same column. So if the first blank cell is D1 i want to go down then D2,D3,D4 etc.

I can do it going across the rows but cannot figure it out using columns.

View Replies!   View Related
Count Blank Cells Within A Range Not Including Fully Blank Rows
I can count the blank cells withiin a range using


But I dont want it to count the cells if the entire row, within that cell, i.e. C6:AD6, is blank.

It should only count the blank cells within a row if there has been some data entered on that row..provided it has been entered within the specified range.

View Replies!   View Related
Imported Data Creates Blank Cells That Aren't Really Blank
Here's what I'm attempting to do: For each column, X,Y, Z, I am attempting
to count nonblanks. However, the data was imported from Access and Oracle,
and Excel treats what appear to be blank cells as nonblanks. I've tested
this theory by highlighting a couple of "blank" cells and deleting them, and
my count changes. So, can I get Excel to put a value into my "blank" cells,
so then I could filter it out, or create a formula that would only count
dates in my columns (which is what I'm after).

This is what I'm looking at:

1 2/4/2006 2/6/2006 ("blank")
2 ("blank") 12/13/2005 1/7/2006
3 2/20/2006 1/15/2006 ("blank")

In each column if I use a COUNTA I'll get a total of 3, instead of 2 for A,
3 for B and 1 for C.

View Replies!   View Related
Asymmetric Fill (fill Out Column B Referencing Column A, But Only Incrementing By 1 Row In A Every 2 Cells In B)
Is there some easy way to fill out column B referencing column A, but only incrementing by 1 row in A every 2 cells in B?


Column A:
A1 = 1
A2 = 2
A3 = 3

Column B (I would like to fill this, referencing column A):
B1 = A1
B2 empty
B3 = A2
B4 empty
B5 = A3

View Replies!   View Related
Replace #VALUE! Error For Blank Cells With Blank Cell
The formula below calculates appropriately, however, if any of the cells (E12,E14, E21, E22, E28, E29) are blank, it returns a #VALUE! error. I would like the cell to remain blank. How can I do this? The formula is listed below.


View Replies!   View Related
Count Blank & Zero Cells Where Corresponding Column Not Blank
I was curious if it is possible to give a single cell multiple number formats based on what the number is in the cell. So for example if my number is bigger than 1000, I would like to use comas so that it looks like this 1,000. However, if it is less than 1000 I would like it to look more like this 999.00.

View Replies!   View Related
Fill Empty Column Cells With Reference To Adjacent Cells
I would like a macro that when run, finds empty cells in a column within the used range and fills them with the same formula in the other cells in the same column but relative to the row.

I have a basic understanding of VBA so if someone can set me on the right track i'll have a go myself as i appreciate this would take a while to write out from scratch.

View Replies!   View Related
Fill Cells Color In Worbook Based On Other Cells
how can I automatically fill cells with certain colors based on the value of the cell. (i.e. I want to search an entire workbook and fill cells with values between 80 and 99 green, 60 to 79 yellow and 0 to 59 red.)

View Replies!   View Related
Highlight Cells On A Form So That A User Knows Which Cells To Fill Out
1. I want to highlight cells on a form so that a user knows which cells to fill out.

2. When they print the form I do not want the cell shading to print.

View Replies!   View Related
Fill Cells Based On Corresponding Cells Matching 3 Criteria
I am working on a spreadsheet for a shoe company. I have separate columns for the size, model, color, and item number of a shoe. I get everything except for the item number from a written document; I then have to find the item number for the shoe from another excell document called the Master List.

I was hoping there would be a way to have Excell auto-fill the item number for me. For example, if a shoe is a Red, Athens (the shoe model),size 12, its item number (which can be a pain to find) listed in the row of the Master List is aaabbb. So I want to just enter in the size, color and model number, and have Excell find the item number for me, and fill it in.

I have enclosed an example. Sheet 1 is the sheet I would be working on. Sheet 2 is a portion of the Item master list, which is actually 50k lines.

View Replies!   View Related
2003 - Merging Four Adjacent Cells With Text And/or Blank Cells
I am trying to merge text, in four adjacent cells in the same row (say cells A1,A2,A3 and A4), into a single cell (say cell A5).

I would like a comma or full stop and then a space between each item merged (cell A5).

The text to be merged may appear in any one of the four cells (cells A1 to A4). Those cells without text are blank.

Only where all 4 cells are blank, will I need cell 'A5' to indicate this.

The formula needs to be relative as I will need to copy the formula down the spreadsheet so that it applies to additional rows.

View Replies!   View Related
Fill Empty Cells With Cells Above
I have a situation where I am trying to copy to blank cells. All the data is in Column A. In Column A there are Account numbers that are attached to dates in Column B and Transaction Amounts in Columns C & D.

If there are multiple dates with transactions, then Column A does not repeat, but is blank until the next Account number. I am trying to have the Account number fill in the blank cells until the next Account number. I have a macro that runs and picks up the Account number and then copies the data in Columns B - D. However, the blank cells are messing up the macro.

View Replies!   View Related
Fill Right For Four Cells
i typically have a difficult time figuring out how to reference cells correctly depending on the situation. anyways what i have is a formula in a cell and i want to fill in the next four cells to the right.

the help file gives:


View Replies!   View Related
Using For-Next To Fill Cells
i have attempted may be totally in the wrong direction. I have a worksheet where column A should hold the same value for many Rows of information, but instead only prints once in the first row of that section. The # of rows in each section vary; sort of like this - where ... is a blank cell:

A 1
... 2
... 3
... 4
B 1
... 2
... 3

I would like to write a macro that loops through Column A and replaces empty cells with the most recent value. When i run the following code it puts the value in the blank cell, but fails to loop to the next.

View Replies!   View Related
Formula To Fill In Cells
I am trying to create a nice equation that will look in row 35 for the highest value and then return the value that is 33 rows up and 1 column to the left. See attachment of for more details.

Basically, I need a formula to fill in cells B38:B41 (detail included in Excel doc attached).

View Replies!   View Related
Fill Down Cells With Formula
I have this formula in the cell

View Replies!   View Related
Auto Fill Cells...
Working with 2 worksheets in the same spreadsheet. In worksheet A cell F6 is a solution (hex2dec) these solutions are staggered consistently in column F (F6, F9, F12, F15 etc) In worksheet B cell A2 displays workshop A cell F6 details (=ATR!F6)
Worksheet B cell A3 Autofil uses (=ATR!F7) I want (=ATR!F9) Worksheet B cell A4 I want (=ATR!F12) How do I condition autofil to follow my chosen sequence ie F6,F9,F12,F15 etc...

View Replies!   View Related
ComboBox Value To Fill Corresponding Cells
I have a spreadsheet dealing with orders made by customers and the delivery of the items they have ordered.

When I have delivered the items to a customer I need to note down that their order has been delivered. I also need to enter the date on which it has been delivered.
I have created a user form in which I select the order number of that particular order from a combobox and state whether or not it has been delivered, this is either a "yes" or "no" selected from another combobox.
I then have to note the date in a text box on which the items were delivered.

My problem is getting the answer "yes" or "no" and the date to fill in on the worksheet next to the corresponding order number.

View Replies!   View Related
Sum Cells By Fill Color
I am getting with the great user defined function (SumColor) you posted here and that I have modified a bit to suit my need. I have a spreadsheet thanks to which I calculate the total cost of a product (find spreadsheet attached below). There are three types of costs:

1. Amortization: always start with AMOXXXXX which I locate in the end of the spreadsheet

2. Assemblies: always start with a 99XXX or 98XXX

3. Components: any other notation (90, 91, 92, etc.)

Each product can have until 5 levels of subassemblies:

1. Level 0: always located in row 8 with big bold letters
2. Level1: cells in yellow (color index = 36).................

View Replies!   View Related
Fill Cells In On Drop Down Selection
when I select a value from my drop down list how can I fill in say.. cell A50 with a number automatically?

Pretty much on a drop down selection I want to fill in another cell.

View Replies!   View Related
Use Dropdown To Fill Cells From A Different Sheet
I have 2 sheets that are used for an inventory that tracks hours on a tool that we use where I work. One sheet allows the user to add items to the inventory along with the current hours on the items. On another sheet, I have several dropdown boxes based on the category of items that are autopopulated with the item's serial numbers through data validation. So far, I'm only able to have the serial numbers fill the dropdown boxes, but I also need to have the hours associated with the individual serial numbers transfer over to this sheet as well in the cell adjacent to the dropdown list.

I assume the pseudocode for this would be for each cell in the dropdown sheet, if it matches a cell in the inventory sheet, grab the cell's value in the hours column and paste it into the adjacent cell on the dropdown sheet, but I'm not sure how to do the actual VBA for it.
I've included my sanitized workbook so you get a better idea of what I need.

View Replies!   View Related
Fill Cells From A List On Another Sheet
I need to populate a range of cells with names from a list on another sheet based on the contents of another cell.

In the attached example;

on sheet 2 cell E3 has a number in it that corresponds to a number in column D on sheet 1, I want to use that as the reference to fill in cell E4 on sheet 2 with the value in column A on sheet 1, then I need to populate the YELLOW cells on sheet 2 with the names from sheet 1 column C that also match the values in sheet 2 cell E3.

The attached file has an example. I have been trying to use LOOKUP and VLOOKUP but can't get it to work.

Can someone please take a look at this for me?

View Replies!   View Related
VBA To Fill In Cells Based On Criteria
I just stumbled onto this forum while Googling around, and it looks great. I'm pretty new to VBA coding so please bear with me. Effectively what I'm looking to do in this mock-up file, is anywhere the currency is "EUR" in column A, I'd like the relative cell in Column G to change to "INSERT TEXT", else I want it to untouched (i.e. to keep the comment it currently has).

View Replies!   View Related
Count Cells By Their Fill Color
how can i count the number of cells by their background/fill color?

Can I use the function COUNTA??

C3A4B5C6D7E8F9G10 11COUNTA(C3:C10)

View Replies!   View Related
Macro - Type In Value, Fill Other Cells W/same Value If
Col D has list of order #'s, starting in row 9. Col M is for COMMENTS about each order. Order #'s can appear in Col D more than once.

What I am looking for is a macro that will automatically detect if I have entered a new COMMENT in Col M, recognise the order # in adjacent Col D, and put my new comment in other cells in Col M if the SAME ORDER # is referenced in adjacent Col D.


worksheet starts with:
Col D Col M
1234 x
123 xyz
1234 zyx
4321 zyx
321 y
1234 yz

If I type the letter "Q" into Col M in a row adjacent to order # 1234, the result should be:
Col D Col M
1234 Q
123 xyz
1234 Q
4321 zyx
321 y
1234 Q

I think I would need to put this macro into a Worksheet Change event but beyond that I do not know what I need. UDF? Macro?

View Replies!   View Related
Copy Cells Within Row Containing Green Fill
Look within sheet "highlowperf" column K and copy the row containing cells that are filled green in column K into sheet "overallperfomers" starting from row 9 within the "overallperformers" sheet until completed. It needs to be from row 9 as i have other data above this which i need to keep intact.

Further to this i do not require all information from the row that is found to contain a green fill. I wish to copy columns A B C D E F G K.

If this second part is not possible I can settle to just copy the whole row over and i will try and work around.

View Replies!   View Related
Fill Color Specific Cells
i would like to be able to fill color numerous rows of cells that have a number in one of the columns that is either above a certain number or below a certain number.

example 3-Nov 5 H
5-Nov -3 V
6-Nov 4 V
9-Nov 12 V
10-Nov -1 H

in this example i want to fill color any row that in column 2 has a number less than -1 and greater than 4.

View Replies!   View Related
Cells With The Same Contents To Fill With The Same Color
I want cells containing the same contents to fill with the same color. But I want different colors for each matched set. I know I can match text to a color, but I may have 100 possible items and to create matches for all 100 would be time consuming and there are not enough colors. I just want random colors picked by excel to create some visual separation to similar cells.

View Replies!   View Related
Fill Cells / Paste Down Column?
I have this formula: =VLOOKUP(C:C,Sheet2!A1:A10000,1,FALSE)

that I need to put in column A from 1 to 26,xxx. Is there a way to paste that formula in every cell down the column without the part in bold changing? I'm not too keen on hitting ctrl+v over 26 thousand times.

View Replies!   View Related
Fill Down For One Cell Impacts All Cells
I have this:

Columns("A:A").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromRightOrBelow
Range("A1") = "Fiscal Year"
Range("A2") = "2010"
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).FillDown
Supposed to insert a column to the left of A, title that column "Fiscal Year"; put the text "2010" into A2, and copy "2010" down to the last cell.

All that works, but somehow, everything else from the other columns in row 2 is copied down.

View Replies!   View Related
Fill Cells In A Column To The End Of A Table
I'm looking the fill cells in column A to the bottom of my table, however, new information is added to the table on a regular basis and so designating the range as cell numbers won't work. Here's what I have so far: ...

View Replies!   View Related
Fill Right Or Down Cells When The Pattern Is Correlative
how to fill right or down cells when the pattern is correlative....but how can I fill the cells to the right when the pattern is not correlative ??? I need to have a differnt pattern when I fill in the picture. This is, I need it move 4 columns on each cell.

View Replies!   View Related
Copy Cells Without Background Fill In VB
I currently have some code that copies a single cell from multiple worksheets. Unfortunately those cells all have a yellow fill and i don't want that fill showing up in my summary sheet. How can i alter this code to copy the cells without the fill.

View Replies!   View Related
Fill Range Down N Cells & Increment By X
I have been frustrated trying figure out what I would assume is actually a pretty simple solution. All I am trying to do is grab a set of cells and repeat them down the column a set number of times. The 2 forms of this are discribed below.

A: I have a set of numbers from A1 to A51 I want to repeate those numbers down the columns 84 times.

B: In addition to this I need to have the cells from B1 to B51 Repeat 84 times but with an increment of 200 each time. So I would have say 1 in B1 - B51 and in B52 - B102 it would turn into 201 and so on and so forth.

View Replies!   View Related
Copyright © 2005-08, All rights reserved