Help with VBA error correction

yummy

Board Regular
Joined
Jan 18, 2011
Messages
63
Below is my code

iStart = 38
'iEnd = Range("A" & iStart).End(xlDown).Row
Set d = CreateObject("scripting.dictionary")
With d
For Each e In Range("E39:E108").Value
'd.CompareMode = vbTextCompare

If Range("J", iStart).Value = "" Then

d.Item(g) = d.Item(g) + 1
iStart = iStart + 1
End If
Next e
Sheets(6).Range("J4").Resize(.count).Insert xlDown
Sheets(6).Range("J4").Resize(.count) = Application.Transpose(.Items)

End With


I am getting an error " Method 'Range' of object _'Global' " failed at line

If Range("J", iStart).Value = "" Then

I have tried but failed to correct without knowing whats wrong.
Can you please help me with this error ?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
This
If Range("J", iStart).Value = "" Then
should be
If Range("J" & iStart).Value = "" Then
Or
If Cells(iStart, "J").Value = "" Then

Hope that helps.
 
Upvote 0
Thanks guys
Stupid mistake I made. Solved it.

Anyways now I am getting another error.

Error say
"Application-defined or object-defined error"
on line
Sheets(6).Range("J4").Resize(.count).Insert xlDown

Bye the way, Its the second time I am setting the object d to

Set d = CreateObject("scripting.dictionary")

in the code.

I tried to change the object d by creating another object but still the same
error.

Any way to pass this hurdle ?
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,111
Members
452,302
Latest member
TaMere

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top