+ Reply to Thread
Results 1 to 3 of 3

Using named fields and ranges in macros

Hybrid View

Bob Summers Using named fields and ranges... 05-03-2005, 12:39 PM
Keyur you have to use quotations... 05-03-2005, 05:01 PM
Bob Summers <Sigh ...> 05-05-2005, 09:48 PM
  1. #1
    Registered User
    Join Date
    05-03-2005
    Posts
    4

    Using named fields and ranges in macros

    I've created a few simple macros to help me maintain a simple user list.
    I would like to use names to define columns, rows, cells and ranges and use them in my macros. For example, part of a macro might use:

    Columns("D:P").Select
    Selection.EntireColumn.Hidden = True

    I can give a name to column D and to Column P but I can't figure out how to use it correctly in the macro. I imagine that I'd use something like:

    Columns(phoneNumber:addressLine3).Select

    but this gives an error.

    It's likely something very simple that I need to do but I can't find the trick via the help information.

    Can you help, Please

    Thanks

    Bob Summers
    Ottawa, Ontario, Canaga

  2. #2
    Registered User
    Join Date
    03-31-2004
    Location
    Toronto, Canada
    MS-Off Ver
    2003/2007
    Posts
    36
    you have to use quotations for the colon

    Columns(phoneNumber & ":" & addressLine3).Select

    Keyur

  3. #3
    Registered User
    Join Date
    05-03-2005
    Posts
    4

    <Sigh ...>

    And it seemed so simple....

    I gave Row 5 the name: "PaymentTitle"

    When I use
    Rows("5:5").Select
    Selection.EntireRow.Hidden = True

    it works fine

    but when I use
    Rows(paymentTitle & ":" & paymentTitle).Select
    Selection.EntireRow.Hidden = True

    I get "Type Mismatch" error 13

    Obviously an simple row NUMBER and a row NAME are not interchangable.

    ???

+ Reply to Thread

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