ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   after filtering, change every cell in column J (https://www.excelbanter.com/excel-programming/436096-after-filtering-change-every-cell-column-j.html)

John Keith

after filtering, change every cell in column J
 
After autofiltering a range of data I next want to change the value of
column J of every row found to "1". What is the mechanism for
specifying the sorted range and changing the value?


John Keith


Bernie Deitrick

after filtering, change every cell in column J
 
If you need to apply the filter:

Sub TryNow()
Dim myR As Range
Set myR = ActiveCell.CurrentRegion
'Apply your filter
myR.AutoFilter Field:=7, Criteria1:="=65", Operator:=xlAnd
Intersect(myR, Range("J2:J" & Rows.Count)).SpecialCells(xlCellTypeVisible).Value = 1
myR.AutoFilter
End Sub

Otherwise, if the filter is applied already

Sub SetJ()

Intersect(ActiveSheet.UsedRange, ActiveSheet.Range("J2:J" & Rows.Count)) _
.SpecialCells(xlCellTypeVisible).Value = 1

End Sub

--
HTH,
Bernie
MS Excel MVP


"John Keith" wrote in message ...
After autofiltering a range of data I next want to change the value of
column J of every row found to "1". What is the mechanism for
specifying the sorted range and changing the value?


John Keith




John Keith

after filtering, change every cell in column J
 
Bernie,

Thank you, I'll try it out this weekend.

Sub SetJ()

Intersect(ActiveSheet.UsedRange, ActiveSheet.Range("J2:J" & Rows.Count)) _
.SpecialCells(xlCellTypeVisible).Value = 1

End Sub



John Keith



All times are GMT +1. The time now is 02:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com