Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA macro Cell argument

HELP PLEASE: trying to compare the result of a cell formula in Cells(A, "C") its contains the result of a Vlookup, I am trying to look for < with another cell Cells(A, "E") the macro runs once then locks up error code 2042. Anyone any ideas please? Or better code !!!

Sub CellCompare()
Dim A As Integer
A = 1
Sheets("NIMROD001").Select
Do Until IsEmpty(Cells(A, "B"))
If Cells(A, "C") < Cells(A, "E") Then ' Doesnt like formulae
Rows(A).Copy
Sheets("Sheet1").Select
Cells(ActiveCell.Row + 1, 1).PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("NIMROD001").Select
End If
A = A + 1
Loop
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VBA macro Cell argument

Les,

I have just tested this and it works for me.

What does your data look like, and what description does 2042 give?

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Les" wrote in message ...
HELP PLEASE: trying to compare the result of a cell formula in Cells(A, "C") its contains the result of a Vlookup, I am trying to look for < with another cell Cells(A, "E") the macro runs once then locks up error code 2042. Anyone any ideas please? Or better code !!!

Sub CellCompare()
Dim A As Integer
A = 1
Sheets("NIMROD001").Select
Do Until IsEmpty(Cells(A, "B"))
If Cells(A, "C") < Cells(A, "E") Then ' Doesnt like formulae
Rows(A).Copy
Sheets("Sheet1").Select
Cells(ActiveCell.Row + 1, 1).PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("NIMROD001").Select
End If
A = A + 1
Loop
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA macro Cell argument

Thanks for the response....

Run-time error '13':
Type mismatch

The macro works fine for the first loop then gives me the error.
"Bob Phillips" wrote in message ...
Les,

I have just tested this and it works for me.

What does your data look like, and what description does 2042 give?

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Les" wrote in message ...
HELP PLEASE: trying to compare the result of a cell formula in Cells(A, "C") its contains the result of a Vlookup, I am trying to look for < with another cell Cells(A, "E") the macro runs once then locks up error code 2042. Anyone any ideas please? Or better code !!!

Sub CellCompare()
Dim A As Integer
A = 1
Sheets("NIMROD001").Select
Do Until IsEmpty(Cells(A, "B"))
If Cells(A, "C") < Cells(A, "E") Then ' Doesnt like formulae
Rows(A).Copy
Sheets("Sheet1").Select
Cells(ActiveCell.Row + 1, 1).PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("NIMROD001").Select
End If
A = A + 1
Loop
End Sub
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA macro Cell argument

One of the cell has this formula in it =VLOOKUP(D7,'Looms from PPAS'!$A$1:$B$1308,2,FALSE)

The other cell just GENERAL alpha numerics...

Spent hours trying to sort this.... very demoralising!!!
"Les" wrote in message ...
Thanks for the response....

Run-time error '13':
Type mismatch

The macro works fine for the first loop then gives me the error.
"Bob Phillips" wrote in message ...
Les,

I have just tested this and it works for me.

What does your data look like, and what description does 2042 give?

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Les" wrote in message ...
HELP PLEASE: trying to compare the result of a cell formula in Cells(A, "C") its contains the result of a Vlookup, I am trying to look for < with another cell Cells(A, "E") the macro runs once then locks up error code 2042. Anyone any ideas please? Or better code !!!

Sub CellCompare()
Dim A As Integer
A = 1
Sheets("NIMROD001").Select
Do Until IsEmpty(Cells(A, "B"))
If Cells(A, "C") < Cells(A, "E") Then ' Doesnt like formulae
Rows(A).Copy
Sheets("Sheet1").Select
Cells(ActiveCell.Row + 1, 1).PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("NIMROD001").Select
End If
A = A + 1
Loop
End Sub
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VBA macro Cell argument

Do you any of your cells have an error value (E.g., #VALUE, #NA,
etc)? If so, you'll get a type mismatch error. Try testing for an
error value

Do Until IsEmpty(Cells(A, "B"))
If IsError(Cells(A, "C")) = False And IsError(Cells(A, "E"))
= False Then
If Cells(A, "C") < Cells(A, "E") Then ' Doesnt like
formulae
Rows(A).Copy
Sheets("Sheet1").Select
Cells(ActiveCell.Row + 1, 1).PasteSpecial
Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("NIMROD001").Select
End If
A = A + 1
Loop



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"Les" wrote in message
...
HELP PLEASE: trying to compare the result of a cell formula in
Cells(A, "C") its contains the result of a Vlookup, I am trying
to look for < with another cell Cells(A, "E") the macro runs
once then locks up error code 2042. Anyone any ideas please? Or
better code !!!

Sub CellCompare()
Dim A As Integer
A = 1
Sheets("NIMROD001").Select
Do Until IsEmpty(Cells(A, "B"))
If Cells(A, "C") < Cells(A, "E") Then ' Doesnt like formulae
Rows(A).Copy
Sheets("Sheet1").Select
Cells(ActiveCell.Row + 1, 1).PasteSpecial
Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("NIMROD001").Select
End If
A = A + 1
Loop
End Sub




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA macro Cell argument

try dim A as Long
iKKi
"Les" wrote in message ...
HELP PLEASE: trying to compare the result of a cell formula in Cells(A, "C") its contains the result of a Vlookup, I am trying to look for < with another cell Cells(A, "E") the macro runs once then locks up error code 2042. Anyone any ideas please? Or better code !!!

Sub CellCompare()
Dim A As Integer
A = 1
Sheets("NIMROD001").Select
Do Until IsEmpty(Cells(A, "B"))
If Cells(A, "C") < Cells(A, "E") Then ' Doesnt like formulae
Rows(A).Copy
Sheets("Sheet1").Select
Cells(ActiveCell.Row + 1, 1).PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("NIMROD001").Select
End If
A = A + 1
Loop
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get cell address from macro function argument oscar New Users to Excel 3 June 1st 06 01:23 AM
argument and Cell Color Tom Excel Programming 3 February 20th 06 05:02 PM
Function (array argument, range argument, string argument) vba Witek[_2_] Excel Programming 3 April 24th 05 03:12 PM
pass argument to macro tommy Excel Programming 4 September 1st 04 06:21 PM
Customized Menu Macro with Argument invoked twice Alan Excel Programming 4 February 6th 04 02:54 PM


All times are GMT +1. The time now is 09:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"