Filling column, skipping a cell if cell is empty

FindingMyself

New Member
Joined
Jun 27, 2011
Messages
19
So the basic idea of my code is:

If Sheets("Settings").Range("A2").Value = "" Then
Sheets("PMChecklist").Range("G1").Value = Sheets("Settings").Range("A23").Value
Sheets("PMChecklist").Range("H1").Value = Sheets("Settings").Range("A24").Value
Sheets("PMChecklist").Range("I1").Value = Sheets("Settings").Range("A25").Value
Else
Sheets("PMChecklist").Range("G1").Value = Sheets("Settings").Range("A2").Value
Sheets("PMChecklist").Range("H1").Value = Sheets("Settings").Range("A3").Value
Sheets("PMChecklist").Range("I1").Value = Sheets("Settings").Range("A4").Value
End If

If Sheets("Settings").Range("A3").Value = "" Then
Sheets("PMChecklist").Range("H1").Value = Sheets("Settings").Range("A23").Value
Sheets("PMChecklist").Range("I1").Value = Sheets("Settings").Range("A24").Value
Sheets("PMChecklist").Range("J1").Value = Sheets("Settings").Range("A25").Value
Else
Sheets("PMChecklist").Range("H1").Value = Sheets("Settings").Range("A3").Value
Sheets("PMChecklist").Range("I1").Value = Sheets("Settings").Range("A4").Value
Sheets("PMChecklist").Range("J1").Value = Sheets("Settings").Range("A5").Value
End If

However, if I do it this way it'll be extremely long and tedious. Is there a way for me to fill the next column with the value of a cell that is not empty? Sorry if this is all confusing...

Edit: I just realized my code logic is totally flawed, basicly what I need to do is fill cell G1 on worksheet1 with the value of cell A2 on worksheet 2. However, if cell A2 is empty, then G1 is filled with the value of cell A23 instead.
 
Last edited:

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Edit: I just realized my code logic is totally flawed, basicly what I need to do is fill cell G1 on worksheet1 with the value of cell A2 on worksheet 2. However, if cell A2 is empty, then G1 is filled with the value of cell A23 instead.
So does that mean you have resolved it yourself, or do you still have a question?
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,682
Members
452,937
Latest member
Bhg1984

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