Select data to imput to macro

  • Thread starter Thread starter sofast1651
  • Start date Start date
S

sofast1651

Regarding the following macro, how do I tell the macro what data to work with
and transfer to one column? Or, how do I select the data and run the macro?
 
You have at least a couple of choices.

You could have the user (you???) select the range first, then run the macro.
Then your macro could work on the current selection.

Or you could ask the user for the range in your macro:

#1.

Dim myRng as range
set myrng = Selection

#2.

Dim myRng as range
set myRng = nothing
on error resume next
set myrng = application.inputbox(Prompt:="Please select a range", type:=8)
on error goto 0

if myrng is nothing then
'user hit cancel
else
'do what you want
end if

But I'm not sure what you're really doing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top