Consulting

Results 1 to 6 of 6

Thread: Declaring Variables in Excel VBA

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Jul 2004
    Location
    Cambridge, England
    Posts
    23
    Location

    Declaring Variables in Excel VBA

    Hi all, dunno the correct terminology (it's not in Lesson 1, Annie!), so apologies if the title's misleading. I've kludged for years, but I am TRYING to learn properly now. Basically I have this :

    Sub Enter_Name()
    x = Application.InputBox("Enter name.")
    n = WorksheetFunction.Find(" ", x) - 1
    Range("H1") = Left(x, n)
    Range("H2") = WorksheetFunction.Substitute(x, Range("H1") & " ", "")
    End Sub
    , which works fine.

    (It's best if I ask one thing at a time, so I'll start with) should I/do I really need to prefix with "Dim x As blah, n As ???", or whatever the heck it's called?

    TIA,
    Andy
    Last edited by Richie(UK); 07-31-2004 at 04:08 AM. Reason: Added VBA tags

Posting Permissions

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