Results 1 to 5 of 5

Thread: How to run macro only selected rows

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    How to run macro only selected rows

    Hi

    I have recorded the macro to run the calculation steps as below. Also, Attached a sheet for better understanding.


    Sub Run_Calc()
    '
    ' Run_Calc Macro
    '
    ' Keyboard Shortcut: Ctrl+g
    '
    Range("S2:K2").Select
    Selection.Copy
    Range("S8:K39").Select
    Range(Selection, Selection.End(xlDown)).Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Calculate
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Application.CutCopyMode = False
    Calculate
    Range("C7").Select
    Selection.End(xlDown).Select
    End Sub
    By running the above macro, sheet got calculated S8 to DK39.

    My desired result is,

    The above function should run only the number of rows I have selected instead of S8 to DK39.

    For Example, If I run the macro while selecting the Row number 10 to 15, Then it should calculate S10 to DK15 only.

    How do I change them to get desired results?

    Expecting positive reply. Thanks in Advance.
    Attached Files Attached Files
    Last edited by Paul_Hossler; 05-10-2018 at 06:36 AM. Reason: Added CODE tags and removed emojies

Posting Permissions

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