Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have this loop below that I programmed on my machine at home, but when I take the same file I run it on at home and the same code and plug it in on another machine at home or even my machine at work I get an error that points to the 'If rng.Value < "0" Then line that says Run-time error '13': Type mismatch Code: -------------------- For i = LaRow To 2 Step -1 Set rng = Range("T" & i) If rng.Value < "0" Then Range("A" & i & ":AE" & i).Interior.ColorIndex = 38 Range("A" & i & ":AE" & i).Interior.Pattern = xlSolid Range("AR" & i).Value = "1" End If Next -------------------- Earlier in the code I have the values in Column T formatted into currency, like so. Code: -------------------- Range("T" & i).Style = "Currency" -------------------- Maybe that has something to do with it? Any help on this error is appreciated. Thanks in advance. -- DKY ------------------------------------------------------------------------ DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515 View this thread: http://www.excelforum.com/showthread...hreadid=393837 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Your code works for me (if LaRow is properly defined). Make sure you have a value assigned to this variable like LaRow =Cells.SpecialCells(xlCellTypeLastCell).Row -- davidm ------------------------------------------------------------------------ davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645 View this thread: http://www.excelforum.com/showthread...hreadid=393837 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Here's what I got. LaRow = Cells(Rows.Count, "E").End(xlUp).Row and this code works perfectly fine on my machine that I made it on. Problem is when I put it on another machine, it doesn't work. I don't understand. If you want to see all my code then I'll show it to you, but that's where it pointed me at in the debug. Why won't it work on some machines? Same file, Same code.... -- DKY ------------------------------------------------------------------------ DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515 View this thread: http://www.excelforum.com/showthread...hreadid=393837 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If the machine where it is a problem is running xl97, then xl97 has problems
comparing a number to a string. Take the double quotes away from "0" and just say if rng.value < 0 then -- Regards, Tom Ogilvy "DKY" wrote in message ... Here's what I got. LaRow = Cells(Rows.Count, "E").End(xlUp).Row and this code works perfectly fine on my machine that I made it on. Problem is when I put it on another machine, it doesn't work. I don't understand. If you want to see all my code then I'll show it to you, but that's where it pointed me at in the debug. Why won't it work on some machines? Same file, Same code.... -- DKY ------------------------------------------------------------------------ DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515 View this thread: http://www.excelforum.com/showthread...hreadid=393837 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I'm running xl 2003 on both machines and I tried removing quotes and get the same error. I dont know what to do -- DK ----------------------------------------------------------------------- DKY's Profile: http://www.excelforum.com/member.php...fo&userid=1451 View this thread: http://www.excelforum.com/showthread.php?threadid=39383 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim i as Long, rng as Range
For i = LaRow To 2 Step -1 Set rng = Range("T" & i) if not iserror(rng) and isnumeric(rng) then If rng.Value < 0 Then Range("A" & i & ":AE" & i).Interior.ColorIndex = 38 Range("A" & i & ":AE" & i).Interior.Pattern = xlSolid Range("AR" & i).Value = 1 End If End If Next -- Regards, Tom Ogilvy "DKY" wrote in message ... I'm running xl 2003 on both machines and I tried removing quotes and I get the same error. I dont know what to do. -- DKY ------------------------------------------------------------------------ DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515 View this thread: http://www.excelforum.com/showthread...hreadid=393837 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Okay, I found out so far that when the macro is in error, i is equal to 449. Meaning that this macro is having a problem with the value of T449. T449 is #N/A (technically, T449 is a formula that says =(H449*R449)+S449......and H449 equals 0, R449 equals 2.98 and S449 is blank.) This macro is obviously having a problem with the #N/A value. -- DKY ------------------------------------------------------------------------ DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515 View this thread: http://www.excelforum.com/showthread...hreadid=393837 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
"Type mismatch" when I try to fill an Array variable with "+" | Excel Discussion (Misc queries) | |||
multiple file uploading - runtime error'13': type mismatch "While Counter <= UBound(FName)" | Excel Discussion (Misc queries) | |||
Run-time Error "13" - File Type Mismatch | Excel Programming | |||
"FIND" generates "Type mismatch" error | Excel Programming | |||
Copying data to another worksheet gives "Type Mismatch" error | Excel Programming |