Macro To Fill Blank Cells
Nov 29, 2006
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.SpecialCells(xlBlanks).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 3 Replies
ADVERTISEMENT
Dec 10, 2013
I have a small challenge, where I am trying to fill blank cells with the data from the last populated cell above.
However, I need it to be able to automatically recognise when a manual entry has beed actioned down the column and recalculate for below that cell with the new data.
The data in the cell is selected from a drop down. I want it to populate all the cells below, until the next drop down is selected. And automatically repopulate them all when it is selected.
E.g. Cell C8 has the value "DATA" selected, and everything below is autofilled with "DATA", but when I select cell C12 with different drop down list value "VALUE", all the cells below stay as "DATA" because they are obviously no longer blank.
What I need if C9 - C11 to remain filled with 'DATA" and from C13 to auto fill with the newly selected value "VALUE".
Need this to happen for as many rows and data selections from the drop down as needed (endless).
I have used:
Code:
Sub FillEmpty() Application.ScreenUpdating = False Application.Calculation = xlManual Dim cell As Range For Each cell In Intersect(Selection, _ ActiveSheet.UsedRange) If Trim(cell) = "" And cell.Row > 1 Then cell.NumberFormat = cell.Offset(-1, 0).NumberFormat cell.Value = cell.Offset(-1, 0).Value End If Next cell Application.Calculation = xlAutomatic 'xlCalculationAutomatic Application.ScreenUpdating = False End Sub
which does the auto fill, but won't change the cells below once one of them has been updated.
Info:
Drop down list has 31 possible selections at the moment
Starts at Cell C8
Needs to be flexible enough to add an indeterminate number of rows, and additional items to the drop down selection.
View 1 Replies
View Related
Apr 17, 2008
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 4 Replies
View Related
Feb 7, 2013
I am using Excel 2010 and basically i am trying to fill a range of cell with a green color if any value was enter in a specific cells. Example: I would like to fill range: A10:c13 with a green color (regardless of the cells content in this range) if a value was entered in cell C10 or C11 or C12 or C13.
I've tried conditional formatting but unfortunately I'll have to apply formatting for every cell and for a range of over hundred cells is not efficient.
View 7 Replies
View Related
Aug 12, 2013
I have a workbook with 15000+ Isometric drawing nos. in column A and and joint nos. in Column B. I want to fill the blank cells with the isometric drawing no.s for the corresponding joint nos. A sample worksheet is attached.
View 8 Replies
View Related
Jul 10, 2007
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.
Monday
Tuesday
[blank cell]
Wednesday
Thursday
[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 6 Replies
View Related
Apr 3, 2008
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
D2-SERVICE CODETO1515
NHSUMM CODETO1515
A0-ATBV TRIO DV .018989
A0-SERVICE CODETO8989
C0-ATBV C HN .017676
C0-ATBV C HNAC .0011
C0-SERVICE CODETO7777
43-ATBETRIOHN .014646
43-ATBETRIOHNAH .0011
43-SERVICE CODETO4747
45-ATBECMBDVRHN .0133
45-ATBECMBDVRHN0 .0033
45-SERVICE CODETO66
NVSUMM CODETO6346963468
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 5 Replies
View Related
Aug 21, 2013
I would like to get some code that will fill blanks in a range.
I have not used the board facilities properly. In the following table I need each blank cell in column B to be filled with the text from the preceding cell that has text in it.
i.e. B2 to be populated with "text1". Cells B4:B6 to be populated with "text2".
The code needs to know that row 9 is the last row to populate.
A
B
1
head
text1
[Code] ........
View 8 Replies
View Related
Nov 30, 2006
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")
Do
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 8 Replies
View Related
Dec 7, 2006
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 4 Replies
View Related
Oct 8, 2007
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 3 Replies
View Related
Feb 1, 2014
I am looking for code that fills empty cells found in columns A-F by copying and pasting the value from the cell of the previous row (of the same column) ignoring columns G onwards. The copying/ pasting then should stop when it encounters its first completely blank row.
View 2 Replies
View Related
Aug 31, 2009
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 8 Replies
View Related
Feb 28, 2013
I have been using this code I found awhile back to fill blank cells in a column with the preceding value. but it leaves the very last cell blank. Like this.
A
B
41055182
905182
41054750
905182
[Code] ........
Is there a way to add possibly a "Do until column B is null or """?
Code:
Sub FillBlanks()
Dim rRange1 As Range, rRange2 As Range
Dim iReply As Integer
If Selection.Cells.Count = 1 Then
MsgBox "You must select your list and include the blank cells", vbInformation, "OzGrid.com"
[Code] ........
View 9 Replies
View Related
Dec 14, 2007
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 3 Replies
View Related
May 7, 2008
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.
Columns("R:R").Select
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
Next
View 4 Replies
View Related
Feb 19, 2014
I'm trying every conceivable angle I can think of in vba and coming up empty. What I have is a spreadsheet similar to this:
Column A Column B
1. 1234567
2. 2345678
3. 3456789
4. 4567890 A0001
5.
6. 9876543
7. 9876543
8. 9876543
9. 1234578
10. 3456789 A0002
What I would like to do is to fill in B1:B3 with A0001 and B6:B9 with A0002. The number of rows in each set of data will vary, but the identifier (A000X) will always be located in the row in column B adjacent to the last entry for that set of data in column A and there will always be empty cells between data sets. The number of data sets will also vary.
View 5 Replies
View Related
Jan 3, 2012
Any other way of subtotaling data. I am an inventory analyst and do monthly/quarterly totals and averages of inventory used, and need a quick way to fill the blank cells with the part # that is below them, as shown below. I need the part #'s so I can then use CONCATENATE() and pull data from multiple time periods so the part #/year will match up down the page.
FILL P100012008360 FILL P100012009286 FILL P10001201072P10001718 FILL P1000220089,075
FILL P1000220091,124 FILL P1000220103,225 FILL P1000220116,375P1000219,799
FILL P10002PL20089,234 FILL P10002PL200912,150P10002PL21,384
View 3 Replies
View Related
Dec 19, 2012
how to fill the blank cells in a Pivot table. I am using Excel 2007. How to do it in excel 2007. Heard that there is a provision in excel 2010 version.
View 9 Replies
View Related
May 6, 2014
I'm using 3 sheets within one Excel file. 1st sheet (target) is called Offer, the 2nd one (source) is called Stock and there's a 3rd one that only contains a button to which i'll assign the final macro. Now, back to it.
I need to copy from Stock to Offer contents of the entire column (basically there are a few more in Offer, so i need to copy each one and place it in a different part). I need to copy from ROW 2 and paste in ROW 6. The length of the document varies, as it's connected to the database (now i can have 3800 rows, in the next hour 3765). Previously i just added an X to row 4500 ( i don't expect to EVER have more than 4000 lines) and just copied from 2 to 4499
Second issue is, on the Offer sheet i have to fill a column with a certain value. Again, it needs to start from Row 6, and needs to be as long as the adjacent column. To get a better idea, i have for example 3800 price lines, so i need the column next to it to be filled with 3800 rows saying GBP (this will be a fixed value).
Also, none of the codes above should exclude blank cells in the middle of the string. Last thing, seems some of the barcodes i have only have 12 digits, so i'll need to add a 0 in front of all shorter numbers to go up to 13 digits.
[Code] ......
I should be able to figure the rest by recording bits and pieces. The Save part is done already, i'm using
[Code] ....
I needed it in XLSX format, not XLSM so that suits just fine. I might need to add hour and minute as well but i can sort it out (as i said, i can do some stuff on my own but this one got me to the bottom).
View 2 Replies
View Related
Jul 25, 2007
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.
Example:
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 9 Replies
View Related
Jul 30, 2012
how to auto fill of same value in different cells in a row?
For Example:
A1 D1 E1 G1 K1
10 10 10 10 10
like that when i hit a macro button the values in the A1 D1 E1 G1 K1 must fill with A2 D2 E2 G2 K2
View 1 Replies
View Related
Sep 20, 2012
I have some information in a column where I have different types of references in each cell with some blank cells in between. I am trying to write a macro that will go down the column until it gets to a cell containing the reference "THIS PAYMENTS" and then copy that cell reference down until it reaches a cell containing "Y-T-D AMOUNTS".But I want the loop to carry on until it reaches another cell containing THIS PAYMENTS.I want this to repeat for about 3000 rows See here before and after result.
Before
After
PERIOD
PERIOD
[Code]....
View 1 Replies
View Related
Dec 22, 2005
Would like a script that will go to each sheet in the workbook, and fill in light grey background, each alternate row that contains data, EXCLUDING the 1st row (header row).
View 9 Replies
View Related
May 28, 2014
Data file with few columns. There are groups of similar ID numbers in Column J. For a group of similar ID numbers in consecutive rows there is only one row that has a number greater than 0 in its Column L cell and the rest of the cells of Column L for that set of similar IDs is filled with 0s.
First for that unique ID group I need to find out which row is it that has a value greater than zero in its Column L cell.
Then I need to use that value to fill the rest of the 0s in Column L corresponding to that set of Unique IDs.
The process continues with identifying similar IDs in Column J and this time doing the same thing for their Column M. I have attached a sample file that shows the data and how the results need to look like.
See here Fill Cells.xlsx
View 1 Replies
View Related
Jun 3, 2014
I need a macro to do the following
Assume A1 has 100 & B1 has 20
The macro should divide 100 by 20 & then fill 20 for number of times I get as the answer starting from B3 9 in this case its 5 times
E.g.: B3 , B4 , B5 , B6 , B7 should be filled with 20
If A1 has 200 & B1 has 50
B3, B4 , B5, B6 should be filled with 50
View 1 Replies
View Related
Jul 2, 2014
I need to combined all non blank cells in a given row into 1 cell. But within each row i have 5 phases that the values fall into, which is denoted by the 1st charter 1, 2, 3, 4, or 5. for example, in a given row i have 1-a, 1-c, 2-d, and 1-f and these values occurs in non consecutive columns starting from G to ALR. I need a macro that sorts these values in one of the 5 phases. So in another sheet the macro would combined [1-a 1-c 1-f] in Phase 1 and [2-d] in phase 2. and if there are other phases it would put them in the appropriate cell.
See attached workbook : Work Order Summary Sheet.xlsx
View 3 Replies
View Related
Jul 17, 2014
However, in addition to what the macro already does, it is possible to add another work sheet in the same work book that outputs the values in separate cells? It also has to output the data in order: for example, in the first work sheet the data is inputted at random and has spaces but the macro will have to remove all the blank cells and output them in order based on the first value in the test string, 1, 2, 3, 4, and then 5;
input:
blank 3-x Blank 1-y blank 2-z 1-k
output:
1-k 1-x 2-z 3-y
View 4 Replies
View Related
Jun 8, 2014
I have a dropdownmanu in sheet1 with different countries taken from Column A in Sheet3. I need a macro to run when i select a country example Denmark. It will fill out transmittal code and also country code in named cells for it in sheet1. Info taken from Sheet3
Transmittal code is in below testsheet in Sheet1 cell E12.
Country code is in Sheet1 cell.
But this have to be possible to change. Also the range for the country have to be possible to change.
This vba code i need to run as soon as i select a country in the dropdown manu.
But one thing i would like to solve also is. When i select a country it will create a dropdownlist in I13 taken from the info in column, i have in Sheet3 column F. So if i select example Denmark, it will show a dropdown menu in sheet1 I13, with the ledger codes 10 and 6x. I have tried to make this work but cant make it work good.
I use excel 2003. Please have a look and upload the testsheet back.
View 14 Replies
View Related
Nov 7, 2008
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 9 Replies
View Related