Hi y21leo and welcome to ExcelForum,
Thank you for using CODE TAGS, it makes answering questions a lot easier. I did not test your code, with the Offsets, but started from the beginning. See the attached file that should help you, with several working examples based on your URL.
In addition:
a. The leading/trailing DOUBLE QUOTES are not needed in the URL string (they probably are needed in the MsgBox string) since there are no embedded DOUBLE QUOTES (or embedded SPACES) in the URL.
b. You might want to replace MsgBox with Debug.Print when doing diagnostic printing. Debug.Print outputs to the IMMEDIATE WINDOW (CTRL G in the debugger).
It is a best practice to declare all variables. If you misspell a variable in your code, VBA will silently assume it is a Variant variable and go on executing with no clue to you that you have a bug. Go to the VBA development window, click Tools, Options, and check "Require Variable Declaration." This will insert the following line at the top of all new modules:
This option requires all variables to be declared and will give a compiler error for undeclared variables.
The following may help debug your code now and in the future:
Debugger Secrets:
a. Press 'F8' to single step (goes into subroutines and functions).
b. Press SHIFT 'F8' to single step OVER subroutines and functions.
c. Press CTRL 'F8' to stop at the line where the cursor is.
d. 'Left Click' the margin to the left of a line to set (or clear) a BREAKPOINT.
e. Press CTRL 'G' to open the IMMEDIATE WINDOW. 'debug.print' statements send their
output to the IMMEDIATE WINDOW.
f. Select View > Locals to see all variables while debugging.
g. To automatically set a BREAKPOINT at a certain location put in the line:
'Debug.Assert False'
h. To conditionally set a BREAKPOINT at a certain location put in lines similar to:
if i >= 20 and xTV20 > 99.56 then
Debug.Assert False
endif
i. A variable value will be displayed by putting the cursor over the variable name.
To manually set a breakpoint, see http://www.wiseowl.co.uk/blog/s196/breakpoints.htm
Lewis
Bookmarks