Announcement

Collapse
No announcement yet.

Saving text from a Command Button

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Saving text from a Command Button



    Hello,
    i have no idea what to look for on here as i am sure this question will be somewhere else.
    I have tried to find a set of VBA functions for this, but no idea what to ask for.
    If someone could please point me int he right direction, i would appreciate it.

    Requirements:
    Press Command Button1 to allow Data to be sent to Sheet2 and added to A2-D2 and then saved, next command onto the next line A3-D3
    At the same time the Text sent to Text on Sheet2 E2 saved the same way as the Data.. Also the text sent to the TextBox1, which is also saved and added in Succession.

    Attached Files

  • #2
    Hello,

    You can test following

    Code:
    Private Sub CommandButton1_Click()
    Dim last As Long
    last = Sheet2.Cells(Rows.Count, 1).End(xlUp).Row + 1
    Sheet2.Range("A" & last & ":" & "D" & last).Value = Sheet1.Range("B6:E6").Value
    End Sub
    Hope this will help
    If you feel like saying "Thank You" for the help received ...You can click on the "Like" icon ...just underneath ... ... in the bottom right corner ...

    Comment


    • #3
      I left a Like and feel like saying Thank You too... Excellent Carim, as now the Data section is copying over to Sheet 2 and also selecting the next row for new additions.

      Now i need to know how to transfer the text over, i guess that will be the same way..

      One thing though... I don't know how to transfer the text to a Text Box though.. I choose a VBA text Box as i need to use a scroller as the new additions grow.

      Comment


      • #4
        I have just managed to send over the text to Sheet2 but only from A6, as i couldn't figure how to link the merged cells.

        Comment


        • #5
          Attached is your test file

          Hope this will help
          Attached Files
          If you feel like saying "Thank You" for the help received ...You can click on the "Like" icon ...just underneath ... ... in the bottom right corner ...

          Comment


          • #6
            Okeh Carim ..Brilliant.. i have that now and its working.. how could i keep the existing text on the TextBox that we paste into

            Comment


            • #7
              Glad to hear macro is working fine

              Thanks for your Thanks ...AND for the Like ..

              Sorry ... but I do not understand your last question ...
              If you feel like saying "Thank You" for the help received ...You can click on the "Like" icon ...just underneath ... ... in the bottom right corner ...

              Comment


              • #8
                I think i need to use something else?. I needed somewhere to add text to, but also keep existing text when updated. I thought i should use a TextBox, but it looks like it can be modified and not locked.
                I thought i should use a VBA TexBox to be able to use a scroll bar. I only know of using a cell.

                I was totally scratching my head for a week then... So happy with the tricks you have shown me though.. Brilliant.

                Here is the finished File in attachments for anyone to suss out and use.
                Attached Files

                Comment


                • #9
                  You can always have a copy of the original text ... AND its modified version in two separate cells ...

                  Glad you could solve your problem.
                  Last edited by Carim; 1 week ago.
                  If you feel like saying "Thank You" for the help received ...You can click on the "Like" icon ...just underneath ... ... in the bottom right corner ...

                  Comment


                  • #10
                    Carim, If it is possible, could you please show me how to delete the Text, leaving a clear sheet.. after the copy and paste, using the same CommandButton1?
                    Last edited by ashming; 5 days ago.

                    Comment


                    • #11
                      Hello,

                      Below is the code modified :

                      Code:
                      Private Sub CommandButton1_Click()
                      Dim last As Long
                      last = Sheet2.Cells(Rows.Count, 1).End(xlUp).Row + 1
                      Sheet2.Range("A" & last & ":" & "D" & last).Value = Sheet1.Range("B6:E6").Value
                      Me.TextBox1.Value = Range("F6").Value
                      Range("F6:I27").ClearContents
                      End Sub
                      Hope this will help
                      If you feel like saying "Thank You" for the help received ...You can click on the "Like" icon ...just underneath ... ... in the bottom right corner ...

                      Comment


                      • #12
                        Great Carim, spot on, thanks again.

                        Comment


                        • #13


                          You are welcome

                          Thanks for your Thanks ..AND for the Like ...
                          If you feel like saying "Thank You" for the help received ...You can click on the "Like" icon ...just underneath ... ... in the bottom right corner ...

                          Comment

                          Working...
                          X