ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   input box - user selects range with mouse? (https://www.excelbanter.com/excel-programming/400398-input-box-user-selects-range-mouse.html)

green fox

input box - user selects range with mouse?
 
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


OssieMac

input box - user selects range with mouse?
 
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

"green fox" wrote:

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



green fox

input box - user selects range with mouse?
 
On Nov 1, 7:29 am, green fox wrote:
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


green fox

input box - user selects range with mouse?
 
On Nov 1, 7:51 am, green fox wrote:
On Nov 1, 7:29 am, green fox wrote:

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


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



All times are GMT +1. The time now is 10:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com