ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Find Multiple Cell Values (https://www.excelbanter.com/excel-discussion-misc-queries/206101-find-multiple-cell-values.html)

Cue

Find Multiple Cell Values
 
For the following line:

whatwant = Sheets("300-+").Range("$A$65000").Value

It will only search for that cell value that is from Sheets "300-+" color
that value on sheet "MultAdjDaily". But instead of one value, I would like it
to search for multiple cells with values and color them on "MultAdjDaily". I
tried the following but it did not work:

whatwant = Sheets("300-+").Range("$A$65000:$A$65125").Value

I want the code to take the multiple cells with values that are on sheet
"300-+" and find them and color them on sheet "MultAdjDaily".

Can you show me what to change in order for that to work?

--
Cue

Dave Peterson

Find Multiple Cell Values
 
You may need to loop through the range to pick out the values from each cell:

dim myCell as range
dim myRng as range
set myrng = Sheets("300-+").Range("$A$65000")

for each mycell in myrng.cells
whatwant = mycell.value
'your code here
next mycell

Cue wrote:

For the following line:

whatwant = Sheets("300-+").Range("$A$65000").Value

It will only search for that cell value that is from Sheets "300-+" color
that value on sheet "MultAdjDaily". But instead of one value, I would like it
to search for multiple cells with values and color them on "MultAdjDaily". I
tried the following but it did not work:

whatwant = Sheets("300-+").Range("$A$65000:$A$65125").Value

I want the code to take the multiple cells with values that are on sheet
"300-+" and find them and color them on sheet "MultAdjDaily".

Can you show me what to change in order for that to work?

--
Cue


--

Dave Peterson

Cue

Find Multiple Cell Values
 
Yes! Thanks Dave for your help!
--
Cue


"Dave Peterson" wrote:

You may need to loop through the range to pick out the values from each cell:

dim myCell as range
dim myRng as range
set myrng = Sheets("300-+").Range("$A$65000")

for each mycell in myrng.cells
whatwant = mycell.value
'your code here
next mycell

Cue wrote:

For the following line:

whatwant = Sheets("300-+").Range("$A$65000").Value

It will only search for that cell value that is from Sheets "300-+" color
that value on sheet "MultAdjDaily". But instead of one value, I would like it
to search for multiple cells with values and color them on "MultAdjDaily". I
tried the following but it did not work:

whatwant = Sheets("300-+").Range("$A$65000:$A$65125").Value

I want the code to take the multiple cells with values that are on sheet
"300-+" and find them and color them on sheet "MultAdjDaily".

Can you show me what to change in order for that to work?

--
Cue


--

Dave Peterson



All times are GMT +1. The time now is 04:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com