Shift cells up for blank rows in multiple columns

dvitale71

New Member
Joined
May 4, 2018
Messages
8
Hi,
I am trying to delete and shift cells up for multiple columns but can't seem to get this to work. Any help is appreciated!

Task: If columns F through K are blank, then delete and shift cells A through K up. (note: I'm trying to shift additional columns A through E)

Here is the code I have edited thus far... however, I'm not sure where to go from here where I would include shifting cells a through k up.

Sub DeleteBlanksShiftUp ()
Dim lRow As Integer
Dim intCol As Long
Dim rngCell As Range, fn


Set fn = Application.WorksheetFunction
Application.ScreenUpdating = False


For intCol = 6 To 11 'Column F = 6
For lRow = 10000 To 9 Step -1 'Range row 10000 to 9
Set rngCell = Cells(lRow, intCol)
With rngCell
.Value = fn.Substitute(rngCell.Value, Chr(160), Chr(32)) 'accounts for space and no break space characters
.Value = Trim(rngCell.Value)
End With
If Len(rngCell) = 0 Then
rngCell.Delete Shift:=xlUp
End If
Set rngCell = Nothing
Next lRow
Next intCol
Application.ScreenUpdating = True
End Sub
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
How about
Code:
If Len(rngCell) = 0 Then
Intersect(rngCell.EntireRow, Range("A:K")).Delete shift:=xlUp
End If
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,162
Members
453,021
Latest member
Justyna P

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