+ Reply to Thread
Results 1 to 2 of 2

how do you put VBA code into excel file?

  1. #1
    Registered User
    Join Date
    02-16-2005
    Posts
    12

    how do you put VBA code into excel file?

    I have used excel, but never have i had to use the Visual Basic Editor...how do you put the code into the worksheet? Copy and Paste?

  2. #2
    Forum Contributor
    Join Date
    02-15-2005
    Location
    Blackpool, UK
    Posts
    137
    Press Alt + F11 to open the VBA code window.

    press CTRL + R to make sure the Project window is open

    Navigate to VBAProject(bookname), where the bookname will be the name of your Excel workbook.

    Doble-click on the sheet name where you want to attach the code, or ThisWorkbook if you want the code to work for all sheets. Actualy I usualy use the menu item Insert>Module. Either way a l;arge white pane should open to the right.

    Paste your code in here. Note that the code should start "Public Sub somename (" or something similar, note the "somename" before the left paraenthisis.

    To run, go back to your sheet and press Alt + F8. You may need to select the macro from a list, this is where you would select the line which contains the "somename" you noted above.

    HTH

    Art

+ 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