Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default "value" works in sheet, not vba

Mike,

The default property of a range object is .Value:

loanorig = Sheets("main").Range("b2")
loanorigrow = Application.Match(loanorig.Value,
Sheets("loan").Range("a1:a3745"), 0)


So, your code sets loanorig to the Value of Cell B2 on worksheet "main"

Try this:

loanorig = Sheets("main").Range("B2").Value
loanorigrow = Application.Match(loanorig, _
Sheets("loan").Range("a1:a3745"), 0)

HTH,
Bernie
MS Excel MVP
"mike allen" wrote in message
...
why would a formula on a spreadsheet work, while reproducing it in code
doesn't? i must be writing code incorrectly.

spreadsheet formula:
=MATCH(VALUE(B2),loan!$A$1:$A$3745,0)

code:
loanorig = Sheets("main").Range("b2")
loanorigrow = Application.Match(loanorig.Value,
Sheets("loan").Range("a1:a3745"), 0)

any thoughts? i am really having problems w/ comparing and transforming
text to values and vice versa. ALL I AM TRYING TO DO IS MATCH THINGS THAT
LOOK ALIKE, but am failing miserably b/c one may be a number, the other

text
(text only b/c it is a formula result---from a number of all things).
reformatting cells does no good. if i can at least get the above problem
worked out, i can get by for now. thanks, (disdraught w/ excel) mike

allen




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
How do i enable "Group" & "Ungroup" in a protected sheet DBLA137 Excel Discussion (Misc queries) 1 March 11th 09 12:20 AM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Excel "Move or Copy" and "Delete" sheet functions dsiama Excel Worksheet Functions 1 December 28th 07 01:57 PM
How do i enable "Group" & "Ungroup" in a protected sheet ruddojo Excel Discussion (Misc queries) 0 June 2nd 06 01:01 AM
Range only works when Sheet Name is "Sheet1" paul reed Excel Programming 4 September 14th 03 08:37 PM


All times are GMT +1. The time now is 09:54 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"