+ Reply to Thread
Results 1 to 5 of 5

form populates the wrong data sheet

  1. #1
    Forum Contributor
    Join Date
    09-09-2014
    Location
    England
    MS-Off Ver
    2013
    Posts
    102

    form populates the wrong data sheet

    Hello all,

    I have created a form, however when I hit my command button to populate the data storage sheet the data is stored in which ever sheet is open rather than the specific data storage sheet? How can I program the command button to only populate to the data storage sheet?

    Thanks in advance for your help.

    Z

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: form populates the wrong data sheet

    It would help to share your code with us.

  3. #3
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: form populates the wrong data sheet

    Reference the worksheet

    Please Login or Register  to view this content.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  4. #4
    Forum Contributor
    Join Date
    09-09-2014
    Location
    England
    MS-Off Ver
    2013
    Posts
    102

    Re: form populates the wrong data sheet

    Private Sub CommandButton1_Click()
    erow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
    Cells(erow, 1).Value = Stem1.Text
    Cells(erow, 2).Value = Stem2.Text
    Cells(erow, 3).Value = Val(NumberofPossibleResponses.Text)
    Cells(erow, 4).Value = Response1.Text
    Cells(erow, 5).Value = Response2.Text
    Cells(erow, 6).Value = Response3.Text
    Cells(erow, 7).Value = Response4.Text
    Cells(erow, 8).Value = Response5.Text
    Cells(erow, 9).Value = Response6.Text
    Cells(erow, 10).Value = AnswerKey.Text
    Cells(erow, 11).Value = ImageFile1Filename.Text
    Cells(erow, 12).Value = Val(ImageFile1xcoordinate.Text)
    Cells(erow, 13).Value = Val(ImageFile1ycoordinate.Text)
    Cells(erow, 14).Value = Val(ImageFile1Scaling.Text)
    Cells(erow, 15).Value = ImageFile2Filename.Text
    Cells(erow, 16).Value = Val(ImageFile2xcoordinate.Text)
    Cells(erow, 17).Value = Val(ImageFile2ycoordinate.Text)
    Cells(erow, 18).Value = Val(ImageFile2Scaling.Text)
    Cells(erow, 19).Value = Qualification.Text
    Cells(erow, 20).Value = CurriculumTopicMain
    Cells(erow, 21).Value = CurriculumAuxiliaryTopic1
    Cells(erow, 22).Value = CurriculumAuxiliaryTopic2
    Cells(erow, 23).Value = Val(TestID.Text)
    Cells(erow, 24).Value = Val(ItemSequenceNumber.Text)
    Cells(erow, 25).Value = Authors
    Cells(erow, 26).Value = QuestionType
    Cells(erow, 27).Value = Val(Marks.Text)
    Cells(erow, 28).Value = Val(Weighting.Text)
    Cells(erow, 29).Value = Val(LevelOfDemand.Text)
    Cells(erow, 30).Value = EditorReviewer
    Cells(erow, 31).Value = Val(Version.Text)
    Cells(erow, 32).Value = StatusInLifecycle
    Cells(erow, 33).Value = StageOfDevelopment
    Cells(erow, 34).Value = AuthorNote
    Cells(erow, 35).Value = IPRCopyrightNote
    Cells(erow, 36).Value = ItemTitle
    Cells(erow, 37).Value = Context
    Cells(erow, 38).Value = TranslatorReviewer
    Cells(erow, 39).Value = StageOfDevelopmentWorkflow
    Cells(erow, 40).Value = EnemyItems
    Range("b2").Value = Stem1
    Range("c2").Value = Stem2
    Range("d2").Value = NumberofPossibleResponses
    Range("e2").Value = Response1
    Range("f2").Value = Response2
    Range("g2").Value = Response3
    Range("h2").Value = Response4
    Range("i2").Value = Response5
    Range("j2").Value = Response6
    Range("k2").Value = AnswerKey
    Range("l2").Value = ImageFile1Filename
    Range("m2").Value = ImageFile1xcoordinate
    Range("n2").Value = ImageFile1ycoordinate
    Range("o2").Value = ImageFile1Scaling
    Range("p2").Value = ImageFile2Filename
    Range("q2").Value = ImageFile2xcoordinate
    Range("r2").Value = ImageFile2ycoordinate
    Range("s2").Value = ImageFile2Scaling
    Range("t2").Value = Qualification
    Range("u2").Value = CurriculumTopicMain
    Range("v2").Value = CurriculumAuxiliaryTopic1
    Range("w2").Value = CurriculumAuxiliaryTopic2
    Range("x2").Value = Val(TestID.Text)
    Range("y2").Value = Val(ItemSequenceNumber.Text)
    Range("z2").Value = Authors
    Range("aa2").Value = QuestionType
    Range("ab2").Value = Val(Marks.Text)
    Range("ac2").Value = Val(Weighting.Text)
    Range("ad2").Value = Val(LevelOfDemand.Text)
    Range("ae2").Value = EditorReviewer
    Range("af2").Value = Val(Version.Text)
    Range("ag2").Value = StatusInLifecycle
    Range("ah2").Value = StageOfDevelopment
    Range("ai2").Value = AuthorNote
    Range("aj2").Value = IPRCopyrightNote
    Range("ak2").Value = ItemTitle
    Range("al2").Value = Context
    Range("am2").Value = TranslatorReviewer
    Range("an2").Value = StageOfDevelopmentWorkflow
    Range("ao2").Value = EnemyItems
    End Sub

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: form populates the wrong data sheet

    Zak

    You have no worksheet references in that code so Cells will refer to whichever sheet is active.

    Which sheet do you want the data to goto?

    If it's Sheet1 then try this.
    Please Login or Register  to view this content.
    By the way, why do you seem to be, kind of, repeating the same code twice?

    PS Can you add code tags when posting code?
    If posting code please use code tags, see here.

+ 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. Auto populates data on another sheet from master worksheet
    By hunglytummy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-20-2014, 08:00 AM
  2. Create a User form that populates another sheet in excel with data from Access.
    By laras08 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-01-2013, 04:03 PM
  3. Need help creating form that populates with data in row
    By benji912 in forum Excel General
    Replies: 12
    Last Post: 03-10-2013, 10:36 PM
  4. [SOLVED] Userform Combobox selection populates wrong data in the textboxes
    By yahya263 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-02-2013, 09:46 AM
  5. Web Form or Form that Populates Columns in Spreadsheet
    By uneek78 in forum Excel General
    Replies: 0
    Last Post: 11-05-2009, 10:49 AM

Tags for this Thread

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