Code to make cell/ range a specified value

Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Code to make cell/ range a specified value

  1. #1
    Board Regular
    Join Date
    Mar 2003
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Code to make cell/ range a specified value

     
    Hi,

    What code do I need to make a specified cell/ range equal a certain value everytime a workbook is opened?

    Many thanks!
    Cheers and Thanks!

    HG

  2. #2
    Board Regular
    Join Date
    Jan 2003
    Location
    Sydney, Australia
    Posts
    131
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    You need to insert this into "This workbook"

    Private Sub Workbook_Open()
    range("a1").value = "YOURVALUE"
    end sub

    Hope this helps.

  3. #3
    MrExcel MVP Barrie Davidson's Avatar
    Join Date
    Feb 2002
    Location
    Winnipeg
    Posts
    2,330
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Put this in the Workbook Open event (change the range and values accordingly):

    Range("A1:B10").Value = "Barrie"

    Regards,
    Barrie Davidson

    "You're only given a little spark of madness. You mustn't lose it." - Robin Williams

  4. #4
    MrExcel MVP phantom1975's Avatar
    Join Date
    Jun 2002
    Location
    Omaha, Nebraska
    Posts
    3,962
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    You might want to also reference the sheet too:

    Sheets("Sheet1").Range("A1").Value = "Barrie's head smells like cheese."
    Silly Billy was here....

    ***************** EXCEL/VB NEWBIES ARE MY FAVORITE! *****************

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com