Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating selection while using the filter function 1

Status
Not open for further replies.

ChrizDK

IS-IT--Management
Dec 11, 2002
7
DK
Hi'

I have the following code: (made by Murad5 on this board)

Sub marker()
Dim myRange As Range, cel As Range
Set myRange = Selection
For Each cel In myRange
cel.Offset(0, 1).Value = "x"
Next
End Sub

I would like the functionality to work, when the cells marked could be in a filtered range. As it is today every cell is updated - and not only those shown on screen.

I hope you can help me out

Best wishes

Christian
 
How are you filtering the data and how are you updating them? Also is this within a table or a query datasheet?

dyarwood
 
Sub marker()
Dim myRange As Range, cel As Range
Set myRange = Selection
For Each cel In myRange.specialcells(xlcelltypevisible)
cel.Offset(0, 1).Value = "x"
Next
End Sub

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Thanks xlbo,

that did the trick.

:O) Christian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top