If Empty Then

Noz2k

Well-known Member
Joined
Mar 15, 2011
Messages
693
I have a list of values which when a button is clicked are copied to a hidden sheet, code is ran, and then they are returned to a new position in the previous sheet.

Using this code

Code:
lngReminders = Sheets("Detailed").Cells(Rows.Count, "F").End(xlUp).Row
ws3.Range("A1") = ws2.Range("A" & lngReminders + 1)
ws3.Range("A2") = ws2.Range("A" & lngReminders + 2)
ws3.Range("A3") = ws2.Range("A" & lngReminders + 3)
 
*Some Code*
 
lngReminders = Sheets("Detailed").Cells(Rows.Count, "F").End(xlUp).Row
ws2.Range("A" & lngReminders + 1) = ws3.Range("A1")
ws2.Range("A" & lngReminders + 2) = ws3.Range("A2")
ws2.Range("A" & lngReminders + 3) = ws3.Range("A3")

However what I want to be able to add to this, is that if the value in the first row is deleted, then I would like the value in the 2nd row to move upto the top, 3rd row to 2nd.

Similarly if the value in the 2nd row is empty I would like the value in the 3rd row to move up to the 2nd row.

I know I can do this with lots of if statements, but as I will be adding more rows to that code (up to about 10), this will end up being a very long statement the way I can work out how to do it.

Any ideas how to do this in a shorter way?
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,224,598
Messages
6,179,818
Members
452,946
Latest member
JoseDavid

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