Code like this:
Nemocnice.jpg' Definition of variable Nemocnice (in Nemocnice Sheet) Sheets("Nemocnice").Select Selection.CurrentRegion.Select Set Nemocnice = Range(Selection.Address)
NID.jpg' Source table named as "OriginalTable" contains columns NID and Nemocnice. OriginalSheet.Select Selection.CurrentRegion.Select Set OriginalTable = Range(Selection.Address)
And here I have the problem:
watch.jpgNID_nemocnice = OriginalTable.Offset(1, NemocniceCol - 2).Resize(OriginalTable.Rows.Count - 1, 2) For Each rw In NID_nemocnice Set MyVar = rw.Cells(1).Value m = Application.Match(rw.Cells(1).Value, Nemocnice.Columns(2), 0) If Not IsError(m) Then OriginalTable.Cells(m, NemocniceCol - 1).Value = rw.Cells(2).Value End If Next rw
So when I enter the For Each loop, the variable rw is empty. As a result it crashes on the yellow line:
Error 424 Object required.Set MyVar = rw.Cells(1).Value
But I can see in the Watch (see image) that the nemocnice is filled with values (almost 40,000 items).





Reply With Quote