Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default dave or someone, quick question

Hey dave, on this code you helped me out with yesterday, I was wondering you
could help me modify it.. instead of it displaying "no match" in the cell, I
would like it to leave the cell untouched, and only change the cell if there
is a match.. i have been messing with it and cant figure it out..
If I have it return "" then it deletes over whatever else was there..

res = Application.Evaluate(myFormula)
If IsError(res) Then
BringBack = " no match "
Else
BringBack = SourceWks.Cells(res, 7).Value
End If
.Offset(0, 6).Value = BringBack
End With
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default dave or someone, quick question

res = Application.Evaluate(myFormula)
if not iserror(res) then .Offset(0, 6).Value = SourceWks.Cells(res,
7).Value

Could what you are asking be this simple or am I missing something?
-Tim

"Michael A" wrote in message
...
Hey dave, on this code you helped me out with yesterday, I was wondering

you
could help me modify it.. instead of it displaying "no match" in the cell,

I
would like it to leave the cell untouched, and only change the cell if

there
is a match.. i have been messing with it and cant figure it out..
If I have it return "" then it deletes over whatever else was there..

res = Application.Evaluate(myFormula)
If IsError(res) Then
BringBack = " no match "
Else
BringBack = SourceWks.Cells(res, 7).Value
End If
.Offset(0, 6).Value = BringBack
End With



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default dave or someone, quick question

Tim, i am extremely new to VB, chances are it is this easy..

"Tim Coddington" wrote:

res = Application.Evaluate(myFormula)
if not iserror(res) then .Offset(0, 6).Value = SourceWks.Cells(res,
7).Value

Could what you are asking be this simple or am I missing something?
-Tim

"Michael A" wrote in message
...
Hey dave, on this code you helped me out with yesterday, I was wondering

you
could help me modify it.. instead of it displaying "no match" in the cell,

I
would like it to leave the cell untouched, and only change the cell if

there
is a match.. i have been messing with it and cant figure it out..
If I have it return "" then it deletes over whatever else was there..

res = Application.Evaluate(myFormula)
If IsError(res) Then
BringBack = " no match "
Else
BringBack = SourceWks.Cells(res, 7).Value
End If
.Offset(0, 6).Value = BringBack
End With




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default dave or someone, quick question

well.. that didn't work. Now it poplulates with all the information from the
previous page instead of the select information.. i have tried messing with
it to the bets of my abilities..now i need an expert..


"Michael A" wrote:

Tim, i am extremely new to VB, chances are it is this easy..

"Tim Coddington" wrote:

res = Application.Evaluate(myFormula)
if not iserror(res) then .Offset(0, 6).Value = SourceWks.Cells(res,
7).Value

Could what you are asking be this simple or am I missing something?
-Tim

"Michael A" wrote in message
...
Hey dave, on this code you helped me out with yesterday, I was wondering

you
could help me modify it.. instead of it displaying "no match" in the cell,

I
would like it to leave the cell untouched, and only change the cell if

there
is a match.. i have been messing with it and cant figure it out..
If I have it return "" then it deletes over whatever else was there..

res = Application.Evaluate(myFormula)
If IsError(res) Then
BringBack = " no match "
Else
BringBack = SourceWks.Cells(res, 7).Value
End If
.Offset(0, 6).Value = BringBack
End With




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default dave or someone, quick question

res = Application.Evaluate(myFormula)
If IsError(res) Then
'do nothing
Else
.Offset(0, 6).Value = SourceWks.Cells(res, 7).Value
End If

(Drop the BringBack completely--even the Dim statement.)

But I think Tim's suggestion should have worked.

Here's his code slightly reformatted.

res = Application.Evaluate(myFormula)
if not iserror(res) then
.Offset(0, 6).Value = SourceWks.Cells(res,7).Value
end if


Michael A wrote:

well.. that didn't work. Now it poplulates with all the information from the
previous page instead of the select information.. i have tried messing with
it to the bets of my abilities..now i need an expert..

"Michael A" wrote:

Tim, i am extremely new to VB, chances are it is this easy..

"Tim Coddington" wrote:

res = Application.Evaluate(myFormula)
if not iserror(res) then .Offset(0, 6).Value = SourceWks.Cells(res,
7).Value

Could what you are asking be this simple or am I missing something?
-Tim

"Michael A" wrote in message
...
Hey dave, on this code you helped me out with yesterday, I was wondering
you
could help me modify it.. instead of it displaying "no match" in the cell,
I
would like it to leave the cell untouched, and only change the cell if
there
is a match.. i have been messing with it and cant figure it out..
If I have it return "" then it deletes over whatever else was there..

res = Application.Evaluate(myFormula)
If IsError(res) Then
BringBack = " no match "
Else
BringBack = SourceWks.Cells(res, 7).Value
End If
.Offset(0, 6).Value = BringBack
End With




--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default dave or someone, quick question

Was you certain to include the 'NOT' in the If IsError statement where I
added it in?

General VBA coding tip:
One thing that has helped me that isn't obvious is the use of Option
Explicit. What that does is requires a Dim statement for EVERY variable you
use. Then if you miss-spell, you know immediatelly.

Yea. Lots of times I find that when something is easy to answer, it is
because I never understood the question.

-T im

"Dave Peterson" wrote in message
...
res = Application.Evaluate(myFormula)
If IsError(res) Then
'do nothing
Else
.Offset(0, 6).Value = SourceWks.Cells(res, 7).Value
End If

(Drop the BringBack completely--even the Dim statement.)

But I think Tim's suggestion should have worked.

Here's his code slightly reformatted.

res = Application.Evaluate(myFormula)
if not iserror(res) then
.Offset(0, 6).Value = SourceWks.Cells(res,7).Value
end if


Michael A wrote:

well.. that didn't work. Now it poplulates with all the information from

the
previous page instead of the select information.. i have tried messing

with
it to the bets of my abilities..now i need an expert..

"Michael A" wrote:

Tim, i am extremely new to VB, chances are it is this easy..

"Tim Coddington" wrote:

res = Application.Evaluate(myFormula)
if not iserror(res) then .Offset(0, 6).Value =

SourceWks.Cells(res,
7).Value

Could what you are asking be this simple or am I missing something?
-Tim

"Michael A" wrote in message
...
Hey dave, on this code you helped me out with yesterday, I was

wondering
you
could help me modify it.. instead of it displaying "no match" in

the cell,
I
would like it to leave the cell untouched, and only change the

cell if
there
is a match.. i have been messing with it and cant figure it out..
If I have it return "" then it deletes over whatever else was

there..

res = Application.Evaluate(myFormula)
If IsError(res) Then
BringBack = " no match "
Else
BringBack = SourceWks.Cells(res, 7).Value
End If
.Offset(0, 6).Value = BringBack
End With




--

Dave Peterson



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
Dave phlogiston appears in spreadsheet cell when I type Dave P tallsaint Excel Discussion (Misc queries) 2 September 4th 09 11:05 AM
Question for Dave Peterson Jenny B. Excel Discussion (Misc queries) 4 March 31st 08 12:07 AM
Dave Peterson - last question Roger Excel Discussion (Misc queries) 6 February 29th 08 09:17 PM
Question for dave Paterson capt Excel Discussion (Misc queries) 8 February 28th 08 12:20 AM
Dave just one more question Jennifer Excel Discussion (Misc queries) 4 April 4th 05 09:08 PM


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