Results 1 to 2 of 2

Help in selecting variable range while creating macro

Threaded View

  1. #1
    Registered User
    Join Date
    04-16-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    1

    Help in selecting variable range while creating macro

    I need a help in selecting range while creating a macros. My requirement is I have recorded a macro which should work in any selected column the range it should select is from the previous column last data row to the top. In the below macro the problem is it is selecting the entire column and data is filled in the entire column from K3:K1048576. Please help me to fix this and it should work in any column.

    Sub Macro3()
    '
    ' Macro3 Macro
    '
    ' Keyboard Shortcut: Ctrl+l
    '
        ActiveCell.FormulaR1C1 = "=RC[-1]/RC7"
        ActiveCell.Select
        Selection.NumberFormat = "0%"
        Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _
            Formula1:="=0.75"
        Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
        With Selection.FormatConditions(1).Font
            .Color = -16383844
            .TintAndShade = 0
        End With
        Selection.FormatConditions(1).StopIfTrue = False
        Selection.Copy
        ActiveCell.Select
        Range(Selection, Selection.End(xlDown)).Select
        ActiveSheet.Paste
    End Sub
    Last edited by Leith Ross; 04-17-2013 at 01:10 AM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1