Yamasaki450
Board Regular
- Joined
- Oct 22, 2021
- Messages
- 71
- Office Version
- 2021
- Platform
- Windows
Hello.
I need some help to modify this VBA... Right now this VBA only works in "Sheet1". I would like it to work in all 8 sheets in my workbook at once... So in "Sheet1, Sheet2, Sheet3, Sheet4, Sheet5, Sheet6, Sheet7, Sheet8"
Is this possible?
Here is VBA i use
I need some help to modify this VBA... Right now this VBA only works in "Sheet1". I would like it to work in all 8 sheets in my workbook at once... So in "Sheet1, Sheet2, Sheet3, Sheet4, Sheet5, Sheet6, Sheet7, Sheet8"
Is this possible?
Here is VBA i use
VBA Code:
Option Explicit
Sub Delete_White_Cells_And_Shift_Up()
Dim t As Double: t = Timer
Dim ws As Worksheet
Set ws = Worksheets("Sheet1") '<-- *** Change sheet name to suit ***
Dim r As Range
Set r = ws.Range("L1627:VQX1627").CurrentRegion
Dim a, b
a = r
ReDim b(1 To UBound(a, 1), 1 To UBound(a, 2))
Dim i As Long, j As Long, k As Long, LRow As Long, LCol As Long
LRow = r.Rows.Count
LCol = r.Columns.Count
k = 1
For j = 1 To LCol
For i = 1 To LRow
If r.Cells(i, j).DisplayFormat.Interior.Color <> RGB(255, 255, 255) Then
b(k, j) = a(i, j)
k = k + 1
End If
Next i
k = 1
Next j
ws.Range("L1627:VQX1627").Resize(LRow, LCol).Value = b
MsgBox Timer - t
End Sub