Troubleshhoot Excel VBA Code Based on Queries

Home More Excel (VBA) Training Videos








How to troubleshoot Excel VBA code. The question is based on our YouTube visitors' queries.

  1. Regarding Transfer of data from one Excel worksheet to another automatically . Rference YouTube video http://youtu.be/grrETxZrks4. The code is not working. I can make only 2 entries and then the data get's overwritten.  Watch the Excel training video for the solution. The complete VBA code is reproduced here:                                                                                                                                 Private Sub CommandButton1_Click()
    Dim customername As String, customerproblem As Integer
    Worksheets("sheet1").Select
    customername = Range("b3")
    customerproblem = Range("b4")
    Worksheets("sheet2").Select
    Worksheets("sheet2").Range("c3").Select
    If Worksheets("sheet2").Range("c3").Offset(1, 0) <> "" Then
    Worksheets("sheet2").Range("c3").End(xlDown).Select
    End If
    ActiveCell.Offset(1, 0).Select
    ActiveCell.Value = customername
    ActiveCell.Offset(0, 1).Select
    ActiveCell.Value = customerproblem
    Worksheets("sheet1").Select
    Worksheets("sheet1").Range("b3").Select
    End Sub
transfer-data-from-one-worksheet-to-another

transfer-data-from-one-worksheet-to-another-result

2.    Regarding Not working VBA code for combo box and userform
Hi Sir,
I have found out your video while trying to search on how to create a userform to enter data. However, I had followed your code but it is not working as it seems in your video. I am not sure where has it gone wrong and can you please help me out. my code is as below:

Private Sub btnenterorder_Click()
Dim RowCount As Long

If Not IsNumeric(Me.tbquantity.Value) Then
MsgBox "The Quantity box must contain a number.", vbExclamation
Me.tbquantity.SetFocus
End If

RowCount = Worksheets("Record Customers").Range("F15").CurrentRegion.Rows.Count
With Worksheets("Record Customers").Range("F15")
.Offset(RowCount, 0) = Me.cmborderdays.Value
.Offset(RowCount, 2) = Me.cmbnewspapertype.Value
.Offset(RowCount, 4) = Me.tbquantity.Value

End With
End Sub


The data is only input in cell F19, J19 and L19. It then gets stuck there and even if i enter new information it only changes the data in cell F19, J9 and L19.

I need the data to be input in cell F15, J15 and L15 onwards.

I would really appreciate your help. My email is doreenchng92@gmail.com and please email to me the solution. If you need further clarification, please email me so I can show you a screenshot of the error.

Thanks so much!

Doreen Chng

Watch the video for more details:


Troubleshhoot Excel VBA Code Based on Queries
Watch the video on YouTube

Reference
Home More Excel (VBA) Training Videos