Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Dynamic Seach Values


Hi all,

I was wondering if it was possible to do something like the following;


Code:
--------------------

If Cells(r, 7).Value < "" & GBM Then

'code is equal to DT Code
Code = Cells(r, 7).Value

'add to find total DT
Data(Code + 2, i) = Data(Code + 2, i) + Cells(r, 8).Value

End If

--------------------


Where GBM is equal to;


Code:
--------------------

If GroupMachine = "All" Then

GBM = ""

Else

GBM = " And Cells(r, 3) = GroupMachine"

End If

--------------------


Its for dynamic search criteria within a spreadsheet. the above could
would work if it was in SQL but doesn't seem to add the GMB string to
the end of my statement.

Any suggestions?


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=510051

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Dynamic Seach Values

If Cells(r, 7).Value < "" And GBM Then

'code is equal to DT Code
Code = Cells(r, 7).Value

'add to find total DT
Data(Code + 2, i) = Data(Code + 2, i) + Cells(r, 8).Value

End If

--------------------


Where GBM is equal to;


Code:
--------------------


If GroupMachine = "All" Then

GBM = True

Else

GBM = (Cells(r, 3) = GroupMachine)

End If


would be one way to do it. You can really throw in a variable condition to
be evaluated.

--
Regards,
Tom Ogilvy


"gti_jobert" wrote
in message ...

Hi all,

I was wondering if it was possible to do something like the following;


Code:
--------------------

If Cells(r, 7).Value < "" & GBM Then

'code is equal to DT Code
Code = Cells(r, 7).Value

'add to find total DT
Data(Code + 2, i) = Data(Code + 2, i) + Cells(r, 8).Value

End If

--------------------


Where GBM is equal to;


Code:
--------------------

If GroupMachine = "All" Then

GBM = ""

Else

GBM = " And Cells(r, 3) = GroupMachine"

End If

--------------------


Its for dynamic search criteria within a spreadsheet. the above could
would work if it was in SQL but doesn't seem to add the GMB string to
the end of my statement.

Any suggestions?


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile:

http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=510051



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Dynamic Seach Values


Thanks for reply,

Have tried your solution but doesn't seem to work. When i do the
following below it works, but when u substitute it for my var names it
doesn't


Code:
--------------------

If Data(1, i) = ActiveCell.Value And Cells(r, 3) = GroupMachine And Cells(r, 2) = GroupSection Then

--------------------


Your suggestion was:


Code:
--------------------

If GroupMachine = "All" Then GBM = True Else GBM = (Cells(r, 3) = GroupMachine)

If Data(1, i) = ActiveCell.Value And GBM

--------------------


Thanks Again, any other way for am I missing something?


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=510051

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Dynamic Seach Values

If that works, use it.

--
Regards,
Tom Ogilvy

"gti_jobert" wrote
in message ...

Thanks for reply,

Have tried your solution but doesn't seem to work. When i do the
following below it works, but when u substitute it for my var names it
doesn't


Code:
--------------------

If Data(1, i) = ActiveCell.Value And Cells(r, 3) = GroupMachine And

Cells(r, 2) = GroupSection Then

--------------------


Your suggestion was:


Code:
--------------------

If GroupMachine = "All" Then GBM = True Else GBM = (Cells(r, 3) =

GroupMachine)

If Data(1, i) = ActiveCell.Value And GBM

--------------------


Thanks Again, any other way for am I missing something?


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile:

http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=510051



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
excel seach Excel-lent Novice Excel Worksheet Functions 1 June 27th 08 11:12 PM
Inserting a string seach within a complex function DJ_Swammi Excel Worksheet Functions 3 December 15th 05 08:30 PM
seach and replace '(' with an '/' Splt Window Diner Excel Discussion (Misc queries) 4 August 20th 05 03:19 PM
Excel Forumla to seach and return all values [email protected] Excel Worksheet Functions 7 December 20th 04 04:54 PM
File name seach within open filetype Andrew[_27_] Excel Programming 0 January 21st 04 06:20 PM


All times are GMT +1. The time now is 03:26 PM.

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"