Adjusting a code snipped in a procedure

bearcub

Well-known Member
Joined
May 18, 2005
Messages
734
Office Version
  1. 365
  2. 2013
  3. 2010
  4. 2007
Platform
  1. Windows
I have a procedure where I am making a copy of another sheet and one from this copy I create separate sheets based upon the text that is contained in a particular column.

To specifiy which column to filter on I'm having the user type "AL1" in an input box and the value in the input box is used to create a filter.

Here is the snippet of code where I think this comes into play:

Code:
    Set objRange = Application.InputBox("Enter AL1 To Filter by SCC", "Range Input", , , , , , 8)

    On Error GoTo 0
    If objRange Is Nothing Then
        Exit Sub
    ElseIf objRange.Columns.Count > 1 Then
        GoTo top
    End If


    FilterCol = objRange.Column
    FilterRow = objRange.Row

The Set objRange is where I type in "AL1".

Then, the FilterCol and FilterRow variables create a filter by Column and by Row. In other words, takes AL1 from the input box and converts it to range that can be used for filtering.

How would I hard code "AL1" into the code so that I don't have to ask the user to enter it in the input box?

Thank you for your help


Michael
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
How about
Code:
Set objRange = Range("AL1")
 
Upvote 0
thank you - that's it.

I initially used the 'Range("AL1").value' but it didn't work. It didn't work because I was specifying cell AL1 as opposed the range starting from AL1?

thank you for the clarification.

Michae
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,201
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top