Adjust macro clear rows if

ste33uka

Active Member
Joined
Jan 31, 2020
Messages
471
Office Version
  1. 365
Platform
  1. Windows
Hi could someone please adjust this macro or offer another macro?
The macro clears the row and the 3 rows below if the number1 is found in column Gi
it clears columns A to FX of rows
What i need it to do is clear columns A to FX and columns GZ to JZ
Example gi4 = 1, A4 TO FX7 and GZ4 to JZ7 would clear.
Thanks

VBA Code:
Sub clear_rows ()
Dim Shtname As String

For sht = 1 To 81
Shtname = "" & sht
With Worksheets(Shtname)
inarr = Range(.Cells(1, 191), .Cells(75, 191)) ' load col A1 to A75 into memory
For i = 4 To UBound(inarr, 1)
If inarr(i, 1) = "1" Then
  .Range(.Cells(i, 1), .Cells(i + 3, 180)) = ""
End If
Next i
End With
Next sht
End Sub
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi,​
as you forgot to post an attachment with the before state and the expected result …​
 
Upvote 0
How about
VBA Code:
If inarr(i, 1) = "1" Then
  .Range(.Cells(i, 1), .Cells(i + 3, 180)) = ""
  .Range(.Cells(i, 208), .Cells(i + 3, 286)) = ""
End If
 
Upvote 0
Solution
How about
VBA Code:
If inarr(i, 1) = "1" Then
  .Range(.Cells(i, 1), .Cells(i + 3, 180)) = ""
  .Range(.Cells(i, 208), .Cells(i + 3, 286)) = ""
End If
Thanks again fluff, thats what i was looking for,
And thanks for all your help on all my other posts.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,208
Members
448,554
Latest member
Gleisner2

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