Filling Empty Cells in Excel

jmaxwell

New Member
Joined
Nov 19, 2010
Messages
16
Hi,

Row 2 cannot be empty before the last data of this row. I need a macro code that will fill in the empty cells before the last data in row 2 with "NA" with the exception if that row has the header "Phone" then I need it to fill that row only with "555555555" and the rest of the empty cell in row 2 with "NA" up until the last data of row 2. The goal here is not to have any empty cells in row 2 up before the last data of this row.

Example 1:
Column--------Header------- Data on row 2
A1------------ First Name ---- John
B1 ------------Last Name ----
C1 ----------- Phone -------- 818555333
D1 ------------State --------
E1 ------------File Num ------ 101

After running macro. Since the B2 and D2 is empty in this example, then B2 and D2 will be fill with "NA"
Column--------Header------- Data on row 2
A1------------ First Name ---- John
B1 ------------Last Name ---- NA
C1 ----------- Phone -------- 818555333
D1 ------------State -------- NA
E1 ------------File Num ------ 101
------------------------------------------------
Example 1:
Column--------Header------- Data on row 2
A1------------ First Name ---- John
B1 ------------Last Name ----
C1 ----------- Phone --------
D1 ------------State --------
E1 ------------File Num ------ 101

After running macro: In this example Cell B2, C2, and D2 are empty, then I need it to be fill with "NA" for B2 & D2 and "5555555555" for C2 since C2 is under the "phone" header.
Example 1:
Column--------Header------- Data on row 2
A1------------ First Name ---- John
B1 ------------Last Name ---- NA
C1 ----------- Phone -------- 5555555555
D1 ------------State -------- NA
E1 ------------File Num ------ 101

I can send you a sample spreadsheet if I am not if I am not cleared. Thanks!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,224,557
Messages
6,179,503
Members
452,917
Latest member
MrsMSalt

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