Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Revise macro (2003)

    I have a simple macro that I would like to revise so that instead of having to unhide personal.xls and open the macro and revise, I would like when the macro runs for it to ask for the column range. Is this possible? Thanks for your help.

    Sub DoFillDown()
    Range("AF2:AF63064").FillDown 'Fill Down a calculation
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Revise macro (2003)

    One option is to let the user select the range before running the macro. The macro can then be simplified to

    Sub DoFillDown()
    Selection.FillDown 'Fill Down a calculation
    End Sub

    If you prefer the macro to prompt for the range, you can use

    Sub DoFillDown()
    Dim rng As Range
    Set rng = Application.InputBox(Prompt:="Please select a range.", _
    Title:="Fill Down", Type:=8)
    If Not rng Is Nothing Then
    rng.FillDown
    End If
    End Sub

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Revise macro (2003)

    Thank you. I really appreciate your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •