Results 1 to 5 of 5

Having the user specify a column when running a macro

Threaded View

  1. #1
    Registered User
    Join Date
    05-20-2008
    Posts
    9

    Having the user specify a column when running a macro

    Hi All,

    I have a very simple macro that I use to highlight duplicates in a column...

    Sub test()
    '
    ' test Macro
    ' Macro recorded 8/21/2008 by Corey G. Garner
    '
    
    '
        Range("A1").Select
        Selection.FormatConditions.Delete
        Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
            "=COUNTIF(A:A,A1)>1"
        Selection.FormatConditions(1).Interior.ColorIndex = 6
        Range("A1").Select
        Selection.Copy
        Columns("A:A").Select
        Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
            SkipBlanks:=False, Transpose:=False
    End Sub

    In this example, the macro is applied to column A. Is there some way that I could have a user be prompted for which column they wish to check for duplicates when they run the macro? Thanks in advance.

    -Corey
    Last edited by VBA Noob; 08-25-2008 at 01:20 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro to Search, Copy/Paste onto New Sheet
    By JADownie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2008, 04:57 PM
  2. Issues pasting in column B and making 2nd macro available
    By sungsam in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-13-2008, 07:03 AM
  3. Error Saving after running Macro
    By millen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-05-2007, 09:14 AM
  4. How to get last name from A Column to copy to B column
    By rd12345 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-23-2007, 06:09 PM
  5. Macro to define name range based on user input
    By truongn2 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-03-2007, 08:53 PM

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