Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a filtered list and want to enter "SOLD" in column A for only the rows
that meet the filter criteria. I am having difficulty acting only on the visible cells. (I am creating the macros by recording my keystrokes, not writing VB code). Whether I enter the value in the first row and copy it down or enter the value in each cell, and press <down arrow to move to the next cell, the macro records specific cell addresses. If I try relative addresses, it records that specific number of rows to move down. Can someone provide some suggestions, or perhaps a bit of code that sets the range to the visible cells in Col. A that I can paste over the code that indicates specific cells? Thanks in advance for your assistance. Regards |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If AutoFilter hides rows then:
Sub sold() Set r = ActiveSheet.UsedRange nLastRow = r.Rows.Count + r.Row - 1 For i = 1 To nLastRow If Cells(i, "A").EntireRow.Hidden Then Else Cells(i, "A").Value = "SOLD" End If Next End Sub -- Gary''s Student - gsnu200767 "Jay Kay" wrote: I have a filtered list and want to enter "SOLD" in column A for only the rows that meet the filter criteria. I am having difficulty acting only on the visible cells. (I am creating the macros by recording my keystrokes, not writing VB code). Whether I enter the value in the first row and copy it down or enter the value in each cell, and press <down arrow to move to the next cell, the macro records specific cell addresses. If I try relative addresses, it records that specific number of rows to move down. Can someone provide some suggestions, or perhaps a bit of code that sets the range to the visible cells in Col. A that I can paste over the code that indicates specific cells? Thanks in advance for your assistance. Regards |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Option Explicit
Sub testme() Dim VRng As Range With Worksheets("sheet1").AutoFilter.Range If .Columns(1).SpecialCells(xlCellTypeVisible).Cells. Count = 1 Then 'nothing but headers are visible MsgBox "nothing but headers" Else Set VRng = .Resize(.Rows.Count - 1, 1).Offset(1, 0) _ .Cells.SpecialCells(xlCellTypeVisible) VRng.Value = "SOLD" End If End With End Sub Jay Kay wrote: I have a filtered list and want to enter "SOLD" in column A for only the rows that meet the filter criteria. I am having difficulty acting only on the visible cells. (I am creating the macros by recording my keystrokes, not writing VB code). Whether I enter the value in the first row and copy it down or enter the value in each cell, and press <down arrow to move to the next cell, the macro records specific cell addresses. If I try relative addresses, it records that specific number of rows to move down. Can someone provide some suggestions, or perhaps a bit of code that sets the range to the visible cells in Col. A that I can paste over the code that indicates specific cells? Thanks in advance for your assistance. Regards -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perfect. Thanks.
"Gary''s Student" wrote: If AutoFilter hides rows then: Sub sold() Set r = ActiveSheet.UsedRange nLastRow = r.Rows.Count + r.Row - 1 For i = 1 To nLastRow If Cells(i, "A").EntireRow.Hidden Then Else Cells(i, "A").Value = "SOLD" End If Next End Sub -- Gary''s Student - gsnu200767 "Jay Kay" wrote: I have a filtered list and want to enter "SOLD" in column A for only the rows that meet the filter criteria. I am having difficulty acting only on the visible cells. (I am creating the macros by recording my keystrokes, not writing VB code). Whether I enter the value in the first row and copy it down or enter the value in each cell, and press <down arrow to move to the next cell, the macro records specific cell addresses. If I try relative addresses, it records that specific number of rows to move down. Can someone provide some suggestions, or perhaps a bit of code that sets the range to the visible cells in Col. A that I can paste over the code that indicates specific cells? Thanks in advance for your assistance. Regards |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
A list of what is being filtered on? | Excel Discussion (Misc queries) | |||
ACTING OUT DROPDOWN LIST ( OR DROPUP) | Excel Worksheet Functions | |||
Macros the same but not acting the same | Excel Programming | |||
Top 25 in a filtered list | Excel Programming | |||
Macros not appearing in the Tools Macro Macros list | Excel Programming |