Hi all
I have workbook with data in sheet(result)
sheet(result).range(F1) have value like: yyyymm=> 201909, 201908 ....
Now I want macro to check that:
1. Get 02 character from right(range(F1)) = b
2. If b <> 12 then check each cell(1,j).value from range(G1, last column)
- If cell(1,j).value = A001 or B002 or C003 then Clear column(j) from row 2 to last row
- Check if b <> 09 or b <> 06 or b <> 03 then check again each cell(i,j).value from range(G1, last column)
If cell(i,j).value = G01 or G02 or G03 then Clear column(j) from row 2 to last row
For Examble clear my idea:
I have workbook with data in sheet(result)
sheet(result).range(F1) have value like: yyyymm=> 201909, 201908 ....
Now I want macro to check that:
1. Get 02 character from right(range(F1)) = b
2. If b <> 12 then check each cell(1,j).value from range(G1, last column)
- If cell(1,j).value = A001 or B002 or C003 then Clear column(j) from row 2 to last row
- Check if b <> 09 or b <> 06 or b <> 03 then check again each cell(i,j).value from range(G1, last column)
If cell(i,j).value = G01 or G02 or G03 then Clear column(j) from row 2 to last row
For Examble clear my idea:
Code:
b = right(sheets(result).range(F1),2)
if b = 12 then do nothing' This's report of year
if b = 09 then 'This is repoert of Quater
check each cell(i,j).value from range(G1, last column)
=> if Cells(1,8).value = "A001" then range(H2:H).clear
=> if Cells(1,9).value = "C003" then range(I2:I).clear
.....
if b =08 then ' This is report of month
check each cell(i,j).value from range(G1, last column)
=> if Cells(1,8).value = "A001" then range(H2:H).clear
=> if Cells(1,9).value = "C003" then range(I2:I).clear
=> if Cells(1,11).value = "G01" then range(K2:K).clear
=> if Cells(1,15).value = "G03" then range(O2:O).clear