VBA to enter text into blank cells within a defined range

excelgeek2023

New Member
Joined
Sep 12, 2023
Messages
5
Office Version
  1. 365
Platform
  1. Windows
I have looked and looked but cant find a solution to this one.

I have a defined range of cells and wherever there is a blank cell, I want to enter text.

I am sure it will be so simple but I only know wo write macros from recording my actions, but this range, although will remain the same, the data within will change and therefore the blanks cells will be different each time.

This macro will need to run within another macro, but essentially my data will have column headers, thought about putting a filter on within the macro, but the cells that are blank will not be the same each time.

Please can anyone assist?

Thanks in advance!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Welcome to the Board!

What exactly do you want to put in these blank cells?
How do we determine which range to look for the blank cells that need to be populated (we really need to know/understand your data structure; a detailed example may be helpful here)?
 
Upvote 0
My range will be greater than the example below, but for this purpose, I would need to enter any text into the blank cells. Really it only needs to be Col.E as my next step would be to enter "1" in cell F3 and autofill down. It is all part or a bigger macro that i am working on....which the way I have worked out how to do it, requires the action above. I will explain further below the full story! If someone has the time to advise on simplifying my whole process then even better and a great learning experience for me! As previously said, I can only write VBA by recording macros.....

1694519429084.png


I need to get my month by month data populated by column, eg. Jan>Feb>Mar etc
 
Upvote 0
to

Jan
Feb
Mar etc

I have built the attached table from numerous other sheets, collated here but for another report, it needs to be in column fashion. I can't filter to "do not show" blanks and then copy the data as each time this values etc are updated the number of rows/range to be copied and pasted will be different.

For this example, I know that my data rows will never exceed 100 rows, I had therefore created a number of Named ranges for each month and the other columns (all the yellow ones), but to do this i had to include columns that had blank cells.

My macro created a new sheet, copied/named the column headers i needed, then copied the named ranges for El1to3 and CostDriver. I then wanted to add 1 to colF (as above) and autofill down but i wanted the autofill to go all the way to row 100 so that when i told the macro to go to range Copy_Jan, it would all be aligned.....copy all the other months and use autofill for the periods, add another column for a lookup in another report and create a pivot table. I have attached my current macro that "works" to a degree....
Not sure if i am explaining myself well enough! I have attached what i have and what i need to get to


1694521304110.png


Data:
MrExcel.xlsx
GHIJKLMNOPQRSTUV
1EL1EL2EL3Cost Driver2024_GBP 12024_GBP 22024_GBP 32024_GBP 42024_GBP 52024_GBP 62024_GBP 72024_GBP 82024_GBP 92024_GBP 102024_GBP 112024_GBP 12
2400019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
3400049312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
4400059312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
5400109312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
6400519312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
7401219312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
8402019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
9403019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
10404019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
11404029312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
12406009312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
13406019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
14406029312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
15406059312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
16420039312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
17420059312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
18430029312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
19430469312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
20430629312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
21440019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
22440049312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
23440059312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
24440109312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
25441019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
26442019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
27442029312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
28442109312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
29442119312503POF4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
30442129312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
31443019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
32450019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
33450029312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
34450039312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
35450049312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
36450059312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
37460039312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
38470019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
39470129312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
40470139312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
41470149312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
42471019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
43473019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
44480019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
45480209312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
46482019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
47489529312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
48490499312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
49490599312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
50490999312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
51499909312503POF4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
52400019481503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
53400059481503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
54401119481503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
55420039481503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
56442019481503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
57489529481503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
58406029312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
59403019312503DPW4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
60403019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
61403019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
62403019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
63403019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
64403019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
65403019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
66403019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
67406019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
68406019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
69406019312503POFM4.448.894.448.8913.3317.7822.2226.6731.1135.5640.0044.44
70------------
71------------
72------------
73------------
74------------
75------------
76------------
77------------
78------------
79------------
80------------
81------------
82------------
83------------
84------------
85------------
86------------
87------------
88------------
89------------
90------------
91------------
92------------
93------------
94------------
95------------
96------------
97------------
98------------
99------------
100------------
Mr Excel Query
 
Upvote 0
Desired outcome:
MrExcel.xlsx
ABCDEFGHIJK
1Sum of Value
2Co-EL1.EL2.EL3-Cost Driver:PeriodCoEL1EL2EL3Cost DriverPeriodValueCo-EL1.EL2.EL3-Cost Driver:PeriodTotal
301-40001.9312.503-POFM:101400019312503POFM14.4444401-.....-.:10
401-40004.9312.503-POFM:101400049312503POFM14.4444401-.....-.:20
501-40005.9312.503-POFM:101400059312503POFM14.4444401-.....-.:30
601-40010.9312.503-POFM:101400109312503POFM14.4444401-.....-.:40
701-40051.9312.503-POFM:101400519312503POFM14.4444401-.....-.:50
801-40121.9312.503-POFM:101401219312503POFM14.4444401-.....-.:60
901-40201.9312.503-POFM:101402019312503POFM14.4444401-.....-.:70
1001-40301.9312.503-POFM:101403019312503POFM14.4444401-.....-.:80
1101-40401.9312.503-POFM:101404019312503POFM14.4444401-.....-.:90
1201-40402.9312.503-POFM:101404029312503POFM14.4444401-40001.9312.503-POFM:14.444444444
1301-40600.9312.503-POFM:101406009312503POFM14.4444401-40001.9312.503-POFM:1035.55555556
1401-40601.9312.503-POFM:101406019312503POFM14.4444401-40001.9312.503-POFM:1140
1501-40602.9312.503-POFM:101406029312503POFM14.4444401-40001.9312.503-POFM:1244.44444444
1601-40605.9312.503-POFM:101406059312503POFM14.4444401-40001.9312.503-POFM:28.888888889
1701-42003.9312.503-POFM:101420039312503POFM14.4444401-40001.9312.503-POFM:34.444444444
1801-42005.9312.503-POFM:101420059312503POFM14.4444401-40001.9312.503-POFM:48.888888889
1901-43002.9312.503-POFM:101430029312503POFM14.4444401-40001.9312.503-POFM:513.33333333
2001-43046.9312.503-POFM:101430469312503POFM14.4444401-40001.9312.503-POFM:617.77777778
2101-43062.9312.503-POFM:101430629312503POFM14.4444401-40001.9312.503-POFM:722.22222222
2201-44001.9312.503-POFM:101440019312503POFM14.4444401-40001.9312.503-POFM:826.66666667
2301-44004.9312.503-POFM:101440049312503POFM14.4444401-40001.9312.503-POFM:931.11111111
2401-44005.9312.503-POFM:101440059312503POFM14.4444401-40001.9481.503-POFM:14.444444444
2501-44010.9312.503-POFM:101440109312503POFM14.4444401-40001.9481.503-POFM:1035.55555556
2601-44101.9312.503-POFM:101441019312503POFM14.4444401-40001.9481.503-POFM:1140
2701-44201.9312.503-POFM:101442019312503POFM14.4444401-40001.9481.503-POFM:1244.44444444
2801-44202.9312.503-POFM:101442029312503POFM14.4444401-40001.9481.503-POFM:28.888888889
2901-44210.9312.503-POFM:101442109312503POFM14.4444401-40001.9481.503-POFM:34.444444444
3001-44211.9312.503-POF:101442119312503POF14.4444401-40001.9481.503-POFM:48.888888889
3101-44212.9312.503-POFM:101442129312503POFM14.4444401-40001.9481.503-POFM:513.33333333
3201-44301.9312.503-POFM:101443019312503POFM14.4444401-40001.9481.503-POFM:617.77777778
3301-45001.9312.503-POFM:101450019312503POFM14.4444401-40001.9481.503-POFM:722.22222222
3401-45002.9312.503-POFM:101450029312503POFM14.4444401-40001.9481.503-POFM:826.66666667
3501-45003.9312.503-POFM:101450039312503POFM14.4444401-40001.9481.503-POFM:931.11111111
3601-45004.9312.503-POFM:101450049312503POFM14.4444401-40004.9312.503-POFM:14.444444444
3701-45005.9312.503-POFM:101450059312503POFM14.4444401-40004.9312.503-POFM:1035.55555556
3801-46003.9312.503-POFM:101460039312503POFM14.4444401-40004.9312.503-POFM:1140
3901-47001.9312.503-POFM:101470019312503POFM14.4444401-40004.9312.503-POFM:1244.44444444
4001-47012.9312.503-POFM:101470129312503POFM14.4444401-40004.9312.503-POFM:28.888888889
4101-47013.9312.503-POFM:101470139312503POFM14.4444401-40004.9312.503-POFM:34.444444444
4201-47014.9312.503-POFM:101470149312503POFM14.4444401-40004.9312.503-POFM:48.888888889
4301-47101.9312.503-POFM:101471019312503POFM14.4444401-40004.9312.503-POFM:513.33333333
4401-47301.9312.503-POFM:101473019312503POFM14.4444401-40004.9312.503-POFM:617.77777778
4501-48001.9312.503-POFM:101480019312503POFM14.4444401-40004.9312.503-POFM:722.22222222
4601-48020.9312.503-POFM:101480209312503POFM14.4444401-40004.9312.503-POFM:826.66666667
4701-48201.9312.503-POFM:101482019312503POFM14.4444401-40004.9312.503-POFM:931.11111111
4801-48952.9312.503-POFM:101489529312503POFM14.4444401-40005.9312.503-POFM:14.444444444
4901-49049.9312.503-POFM:101490499312503POFM14.4444401-40005.9312.503-POFM:1035.55555556
5001-49059.9312.503-POFM:101490599312503POFM14.4444401-40005.9312.503-POFM:1140
5101-49099.9312.503-POFM:101490999312503POFM14.4444401-40005.9312.503-POFM:1244.44444444
5201-49990.9312.503-POF:101499909312503POF14.4444401-40005.9312.503-POFM:28.888888889
5301-40001.9481.503-POFM:101400019481503POFM14.4444401-40005.9312.503-POFM:34.444444444
5401-40005.9481.503-POFM:101400059481503POFM14.4444401-40005.9312.503-POFM:48.888888889
5501-40111.9481.503-POFM:101401119481503POFM14.4444401-40005.9312.503-POFM:513.33333333
5601-42003.9481.503-POFM:101420039481503POFM14.4444401-40005.9312.503-POFM:617.77777778
5701-44201.9481.503-POFM:101442019481503POFM14.4444401-40005.9312.503-POFM:722.22222222
5801-48952.9481.503-POFM:101489529481503POFM14.4444401-40005.9312.503-POFM:826.66666667
5901-40602.9312.503-POFM:101406029312503POFM14.4444401-40005.9312.503-POFM:931.11111111
6001-40301.9312.503-DPW:101403019312503DPW14.4444401-40005.9481.503-POFM:14.444444444
6101-40301.9312.503-POFM:101403019312503POFM14.4444401-40005.9481.503-POFM:1035.55555556
6201-40301.9312.503-POFM:101403019312503POFM14.4444401-40005.9481.503-POFM:1140
6301-40301.9312.503-POFM:101403019312503POFM14.4444401-40005.9481.503-POFM:1244.44444444
6401-40301.9312.503-POFM:101403019312503POFM14.4444401-40005.9481.503-POFM:28.888888889
6501-40301.9312.503-POFM:101403019312503POFM14.4444401-40005.9481.503-POFM:34.444444444
6601-40301.9312.503-POFM:101403019312503POFM14.4444401-40005.9481.503-POFM:48.888888889
6701-40301.9312.503-POFM:101403019312503POFM14.4444401-40005.9481.503-POFM:513.33333333
6801-40601.9312.503-POFM:101406019312503POFM14.4444401-40005.9481.503-POFM:617.77777778
6901-40601.9312.503-POFM:101406019312503POFM14.4444401-40005.9481.503-POFM:722.22222222
7001-40601.9312.503-POFM:101406019312503POFM14.4444401-40005.9481.503-POFM:826.66666667
7101-.....-.:101....1001-40005.9481.503-POFM:931.11111111
7201-.....-.:101....1001-40010.9312.503-POFM:14.444444444
7301-.....-.:101....1001-40010.9312.503-POFM:1035.55555556
7401-.....-.:101....1001-40010.9312.503-POFM:1140
7501-.....-.:101....1001-40010.9312.503-POFM:1244.44444444
7601-.....-.:101....1001-40010.9312.503-POFM:28.888888889
7701-.....-.:101....1001-40010.9312.503-POFM:34.444444444
7801-.....-.:101....1001-40010.9312.503-POFM:48.888888889
7901-.....-.:101....1001-40010.9312.503-POFM:513.33333333
8001-.....-.:101....1001-40010.9312.503-POFM:617.77777778
8101-.....-.:101....1001-40010.9312.503-POFM:722.22222222
8201-.....-.:101....1001-40010.9312.503-POFM:826.66666667
8301-.....-.:101....1001-40010.9312.503-POFM:931.11111111
8401-.....-.:101....1001-40051.9312.503-POFM:14.444444444
8501-.....-.:101....1001-40051.9312.503-POFM:1035.55555556
8601-.....-.:101....1001-40051.9312.503-POFM:1140
8701-.....-.:101....1001-40051.9312.503-POFM:1244.44444444
8801-.....-.:101....1001-40051.9312.503-POFM:28.888888889
8901-.....-.:101....1001-40051.9312.503-POFM:34.444444444
9001-.....-.:101....1001-40051.9312.503-POFM:48.888888889
9101-.....-.:101....1001-40051.9312.503-POFM:513.33333333
9201-.....-.:101....1001-40051.9312.503-POFM:617.77777778
9301-.....-.:101....1001-40051.9312.503-POFM:722.22222222
9401-.....-.:101....1001-40051.9312.503-POFM:826.66666667
9501-.....-.:101....1001-40051.9312.503-POFM:931.11111111
9601-.....-.:101....1001-40111.9481.503-POFM:14.444444444
9701-.....-.:101....1001-40111.9481.503-POFM:1035.55555556
9801-.....-.:101....1001-40111.9481.503-POFM:1140
9901-.....-.:101....1001-40111.9481.503-POFM:1244.44444444
10001-.....-.:101....1001-40111.9481.503-POFM:28.888888889
10101-.....-.:101....1001-40111.9481.503-POFM:34.444444444
10201-40001.9312.503-POFM:201400019312503POFM28.8888901-40111.9481.503-POFM:48.888888889
10301-40004.9312.503-POFM:201400049312503POFM28.8888901-40111.9481.503-POFM:513.33333333
10401-40005.9312.503-POFM:201400059312503POFM28.8888901-40111.9481.503-POFM:617.77777778
10501-40010.9312.503-POFM:201400109312503POFM28.8888901-40111.9481.503-POFM:722.22222222
10601-40051.9312.503-POFM:201400519312503POFM28.8888901-40111.9481.503-POFM:826.66666667
10701-40121.9312.503-POFM:201401219312503POFM28.8888901-40111.9481.503-POFM:931.11111111
10801-40201.9312.503-POFM:201402019312503POFM28.8888901-40121.9312.503-POFM:14.444444444
10901-40301.9312.503-POFM:201403019312503POFM28.8888901-40121.9312.503-POFM:1035.55555556
11001-40401.9312.503-POFM:201404019312503POFM28.8888901-40121.9312.503-POFM:1140
11101-40402.9312.503-POFM:201404029312503POFM28.8888901-40121.9312.503-POFM:1244.44444444
11201-40600.9312.503-POFM:201406009312503POFM28.8888901-40121.9312.503-POFM:28.888888889
11301-40601.9312.503-POFM:201406019312503POFM28.8888901-40121.9312.503-POFM:34.444444444
11401-40602.9312.503-POFM:201406029312503POFM28.8888901-40121.9312.503-POFM:48.888888889
11501-40605.9312.503-POFM:201406059312503POFM28.8888901-40121.9312.503-POFM:513.33333333
11601-42003.9312.503-POFM:201420039312503POFM28.8888901-40121.9312.503-POFM:617.77777778
11701-42005.9312.503-POFM:201420059312503POFM28.8888901-40121.9312.503-POFM:722.22222222
11801-43002.9312.503-POFM:201430029312503POFM28.8888901-40121.9312.503-POFM:826.66666667
11901-43046.9312.503-POFM:201430469312503POFM28.8888901-40121.9312.503-POFM:931.11111111
12001-43062.9312.503-POFM:201430629312503POFM28.8888901-40201.9312.503-POFM:14.444444444
12101-44001.9312.503-POFM:201440019312503POFM28.8888901-40201.9312.503-POFM:1035.55555556
12201-44004.9312.503-POFM:201440049312503POFM28.8888901-40201.9312.503-POFM:1140
12301-44005.9312.503-POFM:201440059312503POFM28.8888901-40201.9312.503-POFM:1244.44444444
12401-44010.9312.503-POFM:201440109312503POFM28.8888901-40201.9312.503-POFM:28.888888889
12501-44101.9312.503-POFM:201441019312503POFM28.8888901-40201.9312.503-POFM:34.444444444
12601-44201.9312.503-POFM:201442019312503POFM28.8888901-40201.9312.503-POFM:48.888888889
12701-44202.9312.503-POFM:201442029312503POFM28.8888901-40201.9312.503-POFM:513.33333333
12801-44210.9312.503-POFM:201442109312503POFM28.8888901-40201.9312.503-POFM:617.77777778
12901-44211.9312.503-POF:201442119312503POF28.8888901-40201.9312.503-POFM:722.22222222
13001-44212.9312.503-POFM:201442129312503POFM28.8888901-40201.9312.503-POFM:826.66666667
13101-44301.9312.503-POFM:201443019312503POFM28.8888901-40201.9312.503-POFM:931.11111111
13201-45001.9312.503-POFM:201450019312503POFM28.8888901-40301.9312.503-DPW:14.444444444
13301-45002.9312.503-POFM:201450029312503POFM28.8888901-40301.9312.503-DPW:1035.55555556
13401-45003.9312.503-POFM:201450039312503POFM28.8888901-40301.9312.503-DPW:1140
13501-45004.9312.503-POFM:201450049312503POFM28.8888901-40301.9312.503-DPW:1244.44444444
Mr Excel Desired outcome
Cell Formulas
RangeFormula
A2:A135A2=B2&"-"&C2&"."&D2&"."&E2&"-"&F2&":"&G2
 
Upvote 0
OK, since you are adept at recording macros, there may be something you can do here to do what you want.

If you select a range (i.e. E3:E100) and then hit the F5 key, select "Special", then click the "Blanks" option, and click "OK", it will select ALL blank cells in that range.
Then, if you enter a value in and hit CTRL+ENTER, it will populate all those blank cells with that value.
It sounds like that may be what you are looking for.

If you record that code and fix it up a little, it can be done in one line of VBA code like this:
VBA Code:
Range("E3:E100").SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=1"
 
Upvote 0
Solution
OK, since you are adept at recording macros, there may be something you can do here to do what you want.

If you select a range (i.e. E3:E100) and then hit the F5 key, select "Special", then click the "Blanks" option, and click "OK", it will select ALL blank cells in that range.
Then, if you enter a value in and hit CTRL+ENTER, it will populate all those blank cells with that value.
It sounds like that may be what you are looking for.

If you record that code and fix it up a little, it can be done in one line of VBA code like this:
VBA Code:
Range("E3:E100").SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=1"
thank you so much!! Solved my problem without having to rewrite my macros :)
 
Upvote 0
You are welcome!
Glad I was able to help!
:)
 
Upvote 1

Forum statistics

Threads
1,223,708
Messages
6,174,006
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top