Copying filtered data
sub getcomments()
ActiveCell.CurrentRegion.Select
set rng = Selection.CurrentRegion.SpecialCells(xlVisible)
set rng = Intersection(rng.EntireRow,Columns(11))
R = rng.Count
Load CommentForm
num = 1
for each cell in rng
CommentForm.ListBox1.AddItem (num & ") " & Cell.Value)
num = num + 1
Next
If Num = 1 Then
CommentForm.ListBox1.AddItem ("No comments")
Else
End If
CommentForm.Show
end sub 'getcomments
--
Regards,
Tom Ogilvy
"cghall55" wrote in message
...
What I am trying to do is display filtered comments from a worksheet in a
list box on a form. Once I have applied a filter to a sheet of data the
code
below starts. The code works except it shows me all comments. I only want
to
see the filtered or Visible comments. How do I step through the filtered
comments? or is there a diffrent way I could go about this?
sub getcomments()
ActiveCell.CurrentRegion.Select
R = Selection.CurrentRegion.Columns(1).SpecialCells(xl Visible).Count
Range("K2").Select
Load CommentForm
num = 1
Do Until ActiveCell.Row R
CommentForm.ListBox1.AddItem (num & ") " & ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
num = num + 1
Loop
If num = 1 Then
CommentForm.ListBox1.AddItem ("No comments")
Else
End If
CommentForm.Show
end sub 'getcomments
|