Troubleshooting Excel VBA Queries

Let’s troubleshoot the Excel VBA queries of our website visitors:

Hi Team,

I´m a Excel VBA beginner and I´m trying to do my stuff based on your examples online. I´m trying to capture data from a userfom into excel. I watched your online video on that topic and I cannot understand

why this doesn´t work in my userform. Here my code:

Private Sub CommandButton1_Click()

erow = mappe1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(erows, 1) = TextBox1.Text
Cells(erows, 2) = TextBox2.Text

End Sub

Please can you help in this matter? Thanks in advance.

Kemm J.

Subject: UserForm

I am creating a userform for calculating the cost of shipping with a certain carrier. The Value of shipping changes with the weight. It is a certain dollar amount per 100.
For this instance I am concentrating on $6.50.
On my userform I have TextBox1 that I will input the weight into. TextBox4 will carry the “result”.
I would like to input just say 100 lbs into TextBox1 and TextBox4 should display 650 but it will only show 600. I have read and realize that decimals are a special case and I can’t for the life of me figure it out.
This is the code that I have. I am VERY new to vba.
Private Sub textbox1_AfterUpdate()

Dim A As Integer

Dim B As Integer

A = Val(TextBox1.Text)

B = 6.5

Dim c As Integer

c = A * B
TextBox4.Text = c
so this gives me only 600 and I have tried to figure out how to make it recognize the decimal but it will not.
any help you would be willing to give?
thank you so much!

Ron

From: Dave

Message: Hi I was wondering if you could tell me what I am doing wrong here I cant get one of your samples to work correctly can you tell me why I would get a \”runtime error 424 object required\” on line 7

Its supposed to copy the rows that have Car in column 1 to sheet 2 Thanks Dave

Sub mycar()
‘Let’s start at row 2. Row 1 has headers
x = 2
‘Start the loop
Do While Cells(x, 1) <> “”
‘Look for data with ‘Car’
If Cells(x, 1) = “Car” Then
‘copy the row if it contains ‘Car’
Worksheets(“Sheet1”).Rows(x).Copy
‘Go to sheet2. Activate it. We want the data here
Worksheets(“Sheet2”).Activate
‘Find the first empty row in sheet2
erow = Sheet2.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
‘Paste the data here
ActiveSheet.Paste Destination:=Worksheets(“Sheet2”).Rows(erow)
End If
‘go to sheet1 again and actvate it
Worksheets(“Sheet1”).Active
‘Loop through the other rows with data
x = x + 1
Loop
End Sub

Sub mycar()
‘Let’s start at row 2. Row 1 has headers
x = 2
‘Start the loop
Do While Cells(x, 1) <> “”
‘Look for data with ‘Car’
If Cells(x, 1) = “Car” Then
‘copy the row if it contains ‘Car’
Worksheets(“Sheet1”).Rows(x).Copy
‘Go to sheet2. Activate it. We want the data here
Worksheets(“Sheet2”).Activate
‘Find the first empty row in sheet2
erow = Sheet2.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
‘Paste the data here
ActiveSheet.Paste Destination:=Worksheets(“Sheet2”).Rows(erow)
End If
‘go to sheet1 again and actvate it
Worksheets(“Sheet1”).Activate
‘Loop through the other rows with data
x = x + 1
Loop
End Sub

Hi there,

I’ve been following a number of your Youtube videos and have been enjoying them immensely and have been learning an enormous amount from them – thank you so very much!!
However, I wonder whether I could please impose a query on you? I’m quite new to working with UserForms. Your Userforms MS Excel video is fantastic and extremely detailed.
I think I have followed your video exactly, yet I get a run-time error 1004:

On this line of code:

eRow = Sheets(“Data”).Cells(Rows.Count, 1).End(x1up).Offset(1, 0).Row

I’m taking the liberty of attaching the workbook with the UserForm and relevant code and was hoping you’d be able to assist me? The UserForm should be called from the button on Worksheet Input and the

data should be placed in the relevant cells on the Worksheet Data in the same workbook.

Thank you in advance.

Fond regards

Han

View the training video below to learn about troubleshooting Excel VBA code:


Leave a Reply

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