HELP!! my macro works fine in debug mode but NOT when running

Joined
Aug 31, 2011
Messages
3
Reaction score
0
Hello everyone,
I seriously need help because this is driving crazy.
I'm doing a macro so that when I paste a table that comes out from SAP (ERP of my company) in the sheet DATA it changes the font, adds some columns, do some Vlookups and some math functions.
Everything works fine in the "detailed step by step" ( I don't know if that's the name in English because I'm working in a French computer with excel 2003) but when I run the program it doesn't.
The problem is that I need to know the last filled row so when I do the autofills they go until the last row. I don't know what happens when it is running but it simply doesn't count so the autofills won't work.
I've tried counting with these functions (each one separately)

Cells.Find("*",SearchOrder:=xlByRows,SearchDirection:=xlPrevious).Row.

Range("A" & Rows.Count).End(xlUp).Row

LR = ActiveSheet.UsedRange.Rows.Count

these three when running give random numbers to LR

and the last one was with a while

LR = 0
While Cells(LR + 1, 1) <> ""
LR = LR + 1
Wend

this one when running gives 0 to LR

What is going on????

I'll attach the whole thing and I'll add a new sheet with the table that I paste I'll name it "TABLE", you have to paste it in DATA, and before you paste it click on the button "nettoyer" or just simple erase anything that is in the "DATA" sheet.
I couldn't send it through here, then go please to the megaupload link:
http://www.megaupload.com/?d=42T2QMPI

Thank you very much!!
 
Back
Top