input box - user selects range with mouse?

  • Thread starter Thread starter green fox
  • Start date Start date
G

green fox

I have an input box where the user is prompted to enter a range to
search for a particular character. In this case a "|". Upon finding
it, its column will be hidden. I would like to have the option to
either type in the range, or use the mouse to select the range.

BTW, I spent two hours debugging this codelet yesterday - tearing my
hair out - turns out my vision was the problem, my code was right from
the start, except for "entireoolumn" AAARGH!

appreciate any help

Andrew J. Fox
 
Hi Andrew,

This example out of code I have been helping someone else with.

Dim rng2 as Range

On Error Resume Next
Set rng2 = Application.InputBox(Prompt:= _
"Please select a range with your Mouse.", _
Title:="SPECIFY RANGE", Type:=8)
On Error GoTo 0

If rng2 Is Nothing Then
MsgBox "User cancelled" _
& Chr(13) & "Processing will terminate"
Exit Sub
End If


Regards,

OssieMac
 
I have an input box where the user is prompted to enter a range to
search for a particular character. In this case a "|". Upon finding
it, its column will be hidden. I would like to have the option to
either type in the range, or use the mouse to select the range.

BTW, I spent two hours debugging this codelet yesterday - tearing my
hair out - turns out my vision was the problem, my code was right from
the start, except for "entireoolumn" AAARGH!

appreciate any help

Andrew J. Fox

Sorry for the trouble, after the posting I was browsing recent topics
and stumbled on an answer. Thanks ossiemac.
The subject line was:

Macro to filter rows containing user defined data

What an amazing - and often humbling - resource this is!

ajf
 
Sorry for the trouble, after the posting I was browsing recent topics
and stumbled on an answer. Thanks ossiemac.
The subject line was:

Macro to filter rows containing user defined data

What an amazing - and often humbling - resource this is!

ajf

Just realized I didn't post my code, what an idiot. FYI here it is,
including ossiemac's contribution:

Sub HideColumnIf()
Dim acell, pr

On Error Resume Next
Set pr = Application.InputBox(Prompt:= _
"Please select a range with your Mouse.", _
Title:="SPECIFY RANGE", Type:=8)
On Error GoTo 0


For Each acell In pr

If acell.Text = "|" Then acell.EntireColumn.Hidden = True

Next acell



End Sub


thanks again,

ajf
 

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

Similar Threads


Back
Top