VBA Code:
Dim ws As Worksheet
Set ws = ShGE03
With ws
Dim RowDataStart As Long
RowDataStart = 5
Dim WSRowEnd As Long
WSRowEnd = .Cells(Rows.Count, 5).End(xlDown).Row
Dim RowDataEnd As Long
RowDataEnd = .Cells(Rows.Count, 5).End(xlUp).
Dim rowdata As Long
'For rowdata = RowDataStart To RowDataEnd 'for referance
End With
Above code is for one of my variables.
I wish to clear data and formatting from Column (“A”) below Row 49 and
except data and formatting in .Range(.Cells(5, "E"), .Cells(rowdata, "I")) and
except data and formatting in .Range(.Cells(5, "Q"), .Cells(rowdata, "Q")) and
clear Column (S) below Row 21 and
clear Column (T) below Row 21 and
clear Column (V) below Row 6
All remaining Columns and Rows should be cleared.
''''''''''''''''tried but will not work
Code:
Dim name3 As String
Dim red3 As long
Dim green3 As long
Dim blue3 As long
Dim index3 As long
Dim item3 As String
Dim Row3 as String
Dim add3 As String
Dim brightness3 As long
'With ws
For Rowdata = RowDataStart To RowDataEnd
name3 = .Range("E5:E" & rowdata).Value
red3 = .Range("F5:F" & rowdata).Value
green3 = .Range("G5:G" & rowdata).Value
blue3 = .Range("H5:H" & rowdata).Value
index3 = .Range("I5:I" & rowdata).Value
item3 = .Range("Q5:Q" & rowdata).Value
Row3 = .Range("S5:S15").Value
add3 = .Range("T5:T15").Value
brightness3 = .Range("V5").Value
Next
End With
With ws
.Cells.Clear
End With
With ws
For Rowdata = RowDataStart To RowDataEnd
.Range("E5:E" & rowdata).Value = name3
.Range("F5:F" & rowdata).Value = red3
.Range("G5:G" & rowdata).Value = green3
.Range("H5:H" & rowdata).Value = blue3
.Range("I5:I" & rowdata).Value = index3
.Range("Q5:Q" & rowdata).Value = item3
.Range("S5:S15").Value = Row3
.Range("T5:T15").Value = add3
.Range("V5").Value = brightness3
Next
End With