(Solved) – Enter textbook value in another sheet in VBA

  • by
(solved)-–-enter-textbook-value-in-another-sheet-in-vba

I have a userform in a sheet called “Dashboard” and a data sheet called “Micrux”.
Every value of the textbox are suppose to be upload in the “micro” sheet, the problem is that it’s upload in my activesheet “Dashboard”.
Is the reason of my problem cause by the WorksheetFunction? Because I also tried something like this:

emptyRow = WorksheetFunction.CountA(Worksheets("Micrux").Range("C:D"))

And it’s still uploading in the wrong sheet.

Private Sub CommandButton1_Enter()

Dim emptyRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Micrux")
ActiveSheet.Name = "Dashboard"


If Not IsDate(TextBox3) Then
        MsgBox " Wrong Format (YYYY/MM/DD)"
        TextBox3 = ""
        Exit Sub
     Else

    End If

emptyRow = WorksheetFunction.CountA(Range("C:D"))

Cells(emptyRow   1, 1).Value = TextBox1.Value
Cells(emptyRow   1, 2).Value = TextBox2.Value
Cells(emptyRow   1, 3).Value = TextBox3.Value


     Unload Me


End Sub

Thanks in advance!

Leave a Reply

Your email address will not be published. Required fields are marked *