View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
RBLampert RBLampert is offline
external usenet poster
 
Posts: 7
Default Pause a macro for user input

Bob, this idea LOOKS like it'll be the answer to a lot of needs, but I can't
make it work. The problem is my EXTREMELY limited programming skills. I
added a Dim statement immediately before this line making rngToCopy an Object
(see code below) but when I run the macro I get an "object required" error
(#424) for your code line. Same thing happens if I designate rngToCopy as a
Range. I sometimes get a tooltip that tells me the value of rngToCopy is
"NOTHING."

Here's the macro code:
Sub EMails2()
'
' EMails2 Macro
' Macro recorded 11/12/2007 by Ross B. Lampert
'

'
Selection.AutoFilter
Selection.AutoFilter Field:=19, Criteria1:="<"
Dim rngToCopy As Object
Set rngToCopy = rngFiltered.SpecialCells(xlCellTypeVisible).Entire Row
Sheets("E-Mails").Select
Range("A2").Select
ActiveSheet.Paste
End Sub

What am I doing wrong?

Thanks.

"Bob Phillips" wrote:

No need. After autofiltering, just copy the visible rows using specialcells

Set rngToCopy = rngFiltered.SpecialCells(xlCellTypeVisible).Entire Row

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"RBLampert" wrote in message
...
I'm trying to create a macro in Excel 2002 which will select certain rows
of
a worksheet using the Autofilter capability. The (non-contiguous) rows
will
then be copied to another worksheet within the file. The number of rows
selected will range from zero on up. Since the number of rows will be
different each time, and I don't know how to get Excel to deal with that
variability, I want to have the macro pause to let the user select the
rows
to be copied, then continue once the selection is made. (Assume the user
will have only minimal skills with Excel.) How do I pause the macro, let
the
user can make his/her selections, then resume the macro? I have VERY
LIMITED
VBA programming skills.