+ Reply to Thread
Results 1 to 9 of 9

Macro - input sheet selection

Hybrid View

  1. #1
    Registered User
    Join Date
    01-29-2007
    Location
    Dobson, NC
    MS-Off Ver
    2000
    Posts
    24

    Macro - input sheet selection

    What do I subsitute or use in a macro to change a sheet reference I selected manually, i.e. Sheets("Sheet1").Select to take the reference in a cell for the sheet name?

    Thanks

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Do you mean you want to rename the active sheet to say the value in cell A1for example??

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    If that's what you meant then try

     
    Sub x()
    ActiveSheet.Name = Range("A1").Value
    End Sub

    VBA Noob

  4. #4
    Registered User
    Join Date
    01-29-2007
    Location
    Dobson, NC
    MS-Off Ver
    2000
    Posts
    24

    Macro - input sheet selection

    No. I want the macro to input data from the active sheet to the sheet name that is identified in cell c4 on the active sheet. I will have a number of sheets with various names which will be identified in C4. Cell C4 and other cells are populated by a dropdown box and manual data entry. That info will be will be transferred the sheet selected in C4 by a enter button. Other sheets will be populated with similar data so the sheet name is the key.

    Thanks and sorry for not describing it clearer.

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Think you need to give more info.

    E.g If say C4 value in activesheet is Sheet2 then what range are you copying and where will it paste to within Sheets??

    VBA Noob

  6. #6
    Registered User
    Join Date
    01-29-2007
    Location
    Dobson, NC
    MS-Off Ver
    2000
    Posts
    24
    Here is the Macro. Just need it to enter on the sheet identified by C4

     
    Sub EnterData()
    '
    ' EnterData Macro
    ' Macro recorded 2/19/2007 by
    '
    ' Keyboard Shortcut: Ctrl+s
    '
        Range("E3:G3").Select
        Selection.Copy
        Sheets ("Sheet4")  
        Range("A7").Select
        Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
            False, Transpose:=False
        Rows("7:7").Select
        Application.CutCopyMode = False
        Selection.Insert Shift:=xlDown
        Rows("28:28").Select
        Selection.Delete Shift:=xlUp
        Sheets("Sheet1").Select
    End Sub
    Last edited by VBA Noob; 02-19-2007 at 05:19 PM.

+ 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