delete blank cells and shift up

RedOctoberKnight

Board Regular
Joined
Nov 16, 2015
Messages
150
Office Version
  1. 2016
Platform
  1. Windows
Good Morning,

Hoping someone could help me out with the following macro. The data copies and pastes values to another workbook but I want to add a command where it deletes all the blank cells in a specified range on the pasted sheet and shifts them up.

VBA Code:
Workbooks.Open "H:\mci-sup\Excel\STAFFING\TRUCKSCHEDULESDUALSIDES.XLSM"
Application.Run "'TRUCKSCHEDULESDUALSIDES.XLSM'!COPYSHEETS"

   With Workbooks("Truck Schedule Builder.xlsm").Worksheets("SUNDAY")
   Workbooks("Truckschedulesdualsides.xlsm").Worksheets(.Range("C1").Text).Range("G5:O39").Value = .Range("AA17:AI51").Value
   Range("G5:O39").SpecialCells(xlCellTypeBlanks).Delete shift:=xlUp
   End With

I dont get any errors but it doesn't delete the blanks cells in the range.

Any help would be much appreciated.

Thanks
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Which sheet name are you trying to delete the blank cells from?
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,040
Members
448,543
Latest member
MartinLarkin

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