Power Query Course in Spanish
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Save As (2)

  1. #1
    Board Regular Ampleford's Avatar
    Join Date
    Mar 2002
    Location
    Scotland
    Posts
    369
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    What about Getting a value from the worksheet say "10", then saving the file as "Filename10.xls" I don't know how to get a value from a worksheet (even if it's named) to the VB editor screen for use in there..... Even how to use functions, like random generators in VB

    Who can help

    Share the Knowledge

    [ This Message was edited by: Ampleford on 2002-03-28 00:21 ]

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Posts
    82
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hello! Are you from UK? you know Ampleforth College in York? I wonder if your nick name comes from it

  3. #3
    Board Regular Ampleford's Avatar
    Join Date
    Mar 2002
    Location
    Scotland
    Posts
    369
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    No - It comes from my surname.

    Although I do know about the College

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Location
    =ActiveCell.Address
    Posts
    478
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,

    All you need to do is split up the path/filename in the save as with & and add in either your variable, or your range.
    i.e.

    ActiveWorkbook.SaveAs Filename:="C:TESTFilename" & myVariable & ".xls", FileFormat:=xlNormal

    ActiveWorkbook.SaveAs Filename:="C:TESTFilename" & Range("A1").value & ".xls", FileFormat:=xlNormal

    Oh, and just to add, to get a value from a worksheet into a variable, you'd have something like

    Dim myVariable As (whatever it is)

    At the top of the macro

    Then
    myVariable = Range("A1").Value

    etc.etc.

    [ This Message was edited by: AJ on 2002-03-28 04:35 ]

  5. #5
    Board Regular Ampleford's Avatar
    Join Date
    Mar 2002
    Location
    Scotland
    Posts
    369
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks a lot - two really helpful hints there.


    Cheers

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
  •