+ Reply to Thread
Results 1 to 4 of 4

if statement place data in according sheet

  1. #1
    Registered User
    Join Date
    01-14-2014
    Location
    south afrcia
    MS-Off Ver
    Excel 2010
    Posts
    7

    if statement place data in according sheet

    hi all

    sitting with a headache here at the moment.

    i need a code that will according to cell E7 save the data according to the worksheet name. the cell E7 is a drop down option, so lets say cell E7 is "arts" then all data entered into the sheet should send the backup to the "arts" tab.


    i have several different tabs namely, arts, crafts, admin, etc. so whenever i choose one of them in cell E7 the data should go to the corresponding sheet.

    this is the code i am currently using and its not working

    [Sub INCOMESHEET_Picture5_Click()
    Dim lastrow As Object

    Set lastrow = Sheets(Range("e7").Value).Range("a6000").End(xlUp)

    lastrow.Offset(1, 0).Value = Sheet4.Range("E7").Text
    lastrow.Offset(1, 1).Value = Sheet4.Range("E9").Text
    lastrow.Offset(1, 2).Value = Sheet4.Range("L7").Text
    lastrow.Offset(1, 3).Value = Sheet4.Range("L9").Text
    lastrow.Offset(1, 4).Value = Sheet4.Range("S7").Text
    lastrow.Offset(1, 5).Value = Sheet4.Range("S9").Text
    lastrow.Offset(1, 6).Value = Sheet4.Range("K48").Text



    MsgBox "ENTRY SUCCESFULL"



    RESPONSE = MsgBox("ANOTHER ENTRY?", vbYesNo)

    If RESPONSE = vbYes Then

    Worksheets("INcome SHEET").Range("C3:u47").PrintOut

    Else

    Worksheets("INcome SHEET").Range("C3:u47").PrintOut


    End If
    End Sub]

    i would really appreciate some help on this one

    thanks
    Last edited by eaztechpro; 01-15-2014 at 05:12 PM.

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: if statement place data in according sheet

    Hi, welcome to the forum.
    You should look at the few rules of the forum and modify your thread before the Moderator warn you. You have topplace your code between CODE tags (See rules #3, I think)

    Anyway, I test your macro and it works quiet well on my computer. One thing you should be aware of is that you must start this macro while your are in the Sheet4 tab. If your command button is in another tab, you'll have to modify thisline of code:
    Please Login or Register  to view this content.
    with this one:
    Please Login or Register  to view this content.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    01-14-2014
    Location
    south afrcia
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: if statement place data in according sheet

    Hi, thanks for the reply

    The thing is. I want the user to only fill in one sheet and the data should go to the sheet that E7 is corresponding with.

    I hope I am making sense

  4. #4
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: if statement place data in according sheet

    You are making sense.
    From what you are saying, users will fill in the cells in Sheet4 (whatever it's name is) and the command button to trigger the transfer WILL also be in that sheet. Right? If not, you have to modify the line of code I told you to in the previous post.
    One thing you must double check is the names of your tabs and the words you place in your validation range. They must be exactly the same. Look for extra sapce at the end of a word. It does not show up by looking at it but it will bug the macro.

    When you say it does not work, what are you getting? An error message? If so, which one?
    If not, what is the final result?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Place Data Table in different sheet to raw data?
    By Aland2929 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-08-2013, 01:28 PM
  2. Use fill form to place data on a specific sheet without "acitvating" the sheet...
    By Skinny Slim in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-08-2012, 07:38 PM
  3. compare and get data from many sheets and place it in another sheet
    By mtsf in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-11-2011, 05:36 AM
  4. Replies: 4
    Last Post: 05-25-2009, 11:29 PM
  5. Big sheet..neeed to jump from place to place
    By RHagerty in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-12-2007, 07:48 AM

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