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 . Reference 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
customername = Range(“b3”)
customerproblem = Range(“b4”)
If Worksheets(“sheet2”).Range(“c3”).Offset(1, 0) <> “” Then
ActiveCell.Value = customername
ActiveCell.Value = customerproblem
2. Regarding Not working VBA code for combo box and userform
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
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
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 email@example.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!
Watch the video for more details:
Troubleshoot Excel-vba Code