Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Private Sub updateentry_Click()
If Len(c1.Value) = 0 Then
MsgBox "Select Status"
End If

Dim VL
VL = ListBox1.Column(0)                       
Dim X1 As Long, Y1 As Long
X1 = Sheet1.Range("A" & Rows.Count).End(xlUp).Row
For Y1 = 2 To X1
If Sheet1.Cells(Y1, 1).Value = VL Then
Sheet1.Cells(Y1, 4).Value = c1.Value
End If
Next Y1

MsgBox "DATA UPDATED"
Sheet3.Range("A2:D2") = ""
Call Module1.FIL_DATA

If Sheet3.Range("A4").Value = "" Then
ListBox1.RowSource = ""
Else
ListBox1.RowSource = "DATA1"
End If

End Sub


What I have tried:

Please Can anyone help me with this Error?
Posted
Updated 13-Sep-21 0:44am
Comments
Patrice T 13-Sep-21 6:31am    
You forgot to tell what is the error.
give complete error message if any.
Member 15329613 13-Sep-21 10:30am    
What's the problem?

1 solution

"It doesn't work" is probably the most useless problem report we get - and we get it a lot. It tells us nothing about what is happening, or when it happens.
So tell us what it is doing that you didn't expect, or not doing that you did.
Tell us what you did to get it to happen.
Tell us any error messages.

Remember that we can't run your code with your data: we have no access to either!

So assuming it's not a syntax error (in which case we have no idea what your code is meant to do, much less any way to run it and guess) it's going to be up to you.
Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. See here: VBA – Debug.Print and the Immediate Window - Automate Excel[^] and here: https://www.bluepecantraining.com/portfolio/excel-vba-debugging-techniques/[^]

Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.

Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900