+ Reply to Thread
Results 1 to 5 of 5

writing macro for multiple cells

  1. #1
    Forum Contributor
    Join Date
    07-26-2007
    MS-Off Ver
    2007
    Posts
    102

    writing macro for multiple cells

    What is the format when writing macros in Visual Basic to specify multiple cells. I want to include it in every cell in a column and multiple columns and don't want to type each one individually. Thank You

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474
    not knowing what kind of code you are talking about I will just give you this bit until you clarify more

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-26-2007
    MS-Off Ver
    2007
    Posts
    102
    Here is the code:

    PrivateSubWorksheet_SelectionChange (ByVal Target As Range)
    Select Case Target.Address
    Case "$B$5"
    Call Open Calendar
    End Select
    End Sub

    However, for case I want to include L4:L311,O4:O311,P4:P311,T4:T311,R4:R:311,V4:V311,W4:W311

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Target.Address multiple ranges

    Hi,
    Hopefully you mean to call a macro when a range is selected(B5)

    this type of code will work for multiple target ranges
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    jcarstens

    Please read forum rules & wrap your VBA code - see links below

    If you do not understand the VBA code wrap instructions have a look at my last reply in this thread
    http://www.excelforum.com/showthread.php?t=583950
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

+ 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