Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Wrong value when loading data

0

Need some help please,
Workbook added
Seems when i select Mike Floye in G2
It loads his data but i get on D10 field3 the image location instead of the correct value and the row11 it loads correct?

If we select Sylv Floye in G2 the D10 field3 is correct? so i don't know

where i go wrong :(

Any idea please.

Thank you

Answer
Discuss

Answers

0
Selected Answer

Hi. Not sure of the overall design or intention of your code but I think the problem is in the sheet11 sub Worksheet_Change(ByVal Target As Range).

If you comment out these lines, 

'If Not Intersect(Target, Range("D10:D20")) Is Nothing And Range("D" & Target.row).value <> Empty Then
'Equip_Load
'End If

then the sheet updates correctly (I think) for G2 selections of Mike, Floye or Sylve,Floye (who have data in sheet CustomerItems)

I think the problem without that, when you change G2, it triggers the sub Empl_Load via these lines: 

If Not Intersect(Target, Range("G2")) Is Nothing Then
    If Range("G2").value <> Empty And Range("B5").value <> Empty Then Empl_Load

That Empl_Load sub alters column D which again triggers the Worksheet_Change sub. This time (since D2 has some spaces in), it triggers Empl_Load again via the lines I commented out above.

In my case (without the change abve), the worksheet crashes when Mike, Floye is selected.

Discuss

Discussion

Thanks John_Ru
Seems you where right.
I removed that part and works fine
Thanks
GhostofWanted (rep: 46) Nov 29, '20 at 10:15 am
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login