Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Cell Variables

  1. #1
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Christchurch New Zealand
    Posts
    1,030
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Can you assign a Cell value to a variable and can you make a permanant variable that changes via an inputbox??

  2. #2
    MrExcel MVP Damon Ostrander's Avatar
    Join Date
    Feb 2002
    Location
    Denver, Colorado USA
    Posts
    4,239
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Yes, you can do both. To assign a cell value to a variable:

    Dim CellVal As Variant
    CellVal = [B4].Value

    puts the value from cell B4 into the variable named CellVal.

    To assign a variable from an InputBox:

    Dim CellVal As Variant
    CellVal = Application.InputBox("Enter User Name", Type:=3)

    where the Type:=3 indicates that you are expecting the user to enter a text string (set other type values for other data types)


    Keep Excelling.

    Damon

    VBAexpert Excel Consulting
    LinkedIn Profile http://www.linkedin.com/pub/damon-ostrander/7/79/a93
    AllExperts Profile http://www.allexperts.com/ep/1059-30...-Ostrander.htm

  3. #3
    New Member
    Join Date
    Feb 2002
    Location
    Turkey
    Posts
    36
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-02-20 21:38, Damon Ostrander wrote:
    Yes, you can do both. To assign a cell value to a variable:

    Dim CellVal As Variant
    CellVal = [B4].Value

    puts the value from cell B4 into the variable named CellVal.

    To assign a variable from an InputBox:

    Dim CellVal As Variant
    CellVal = Application.InputBox("Enter User Name", Type:=3)

    where the Type:=3 indicates that you are expecting the user to enter a text string (set other type values for other data types)


    Could you please tell me how can you assign the CellVal to another cell from another makro?
    Thanks

Some videos you may like

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
  •