ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   if then multiple sheets and values (https://www.excelbanter.com/excel-programming/405652-if-then-multiple-sheets-values.html)

Danny[_2_]

if then multiple sheets and values
 
I use ms excel 2002. I have a workbook with multiple sheets. I want
a macro that will look at all active cells and specific values in one
column say column C in a worksheet1 and copy that cell and
corresponding A column cell to that C cell into another worksheet in
column A and C.

Example
Worksheet 1 if C1 value ="Value1" or "Value2" or "Value3" then copy
C1 and related field A1 from worksheet 1 to worksheet 2 fields C1 and
A1 respectively.

If it doesn't equal "Value1" or "Value2 " or "Value3" don't do
anything.

The macro needs to read worksheet 1 all active cells from C2 on ????



If this is not clear please post for clarifying

Thanks
D


joel

if then multiple sheets and values
 
NewRowCount = 1
for each sh in thisworkbook.sheets
for rowCount = 1 to 1000
if sh.range("A" & RowCount) = 5 and _
sh.range("B" & RowCount) = 10 then

sh.rows(rowcount).copy _
destination:=Sheets("Summary").Rows(NewRowCount)
NewRowCount = NewRowCount + 1
end if
next RowCount

next sh

"Danny" wrote:

I use ms excel 2002. I have a workbook with multiple sheets. I want
a macro that will look at all active cells and specific values in one
column say column C in a worksheet1 and copy that cell and
corresponding A column cell to that C cell into another worksheet in
column A and C.

Example
Worksheet 1 if C1 value ="Value1" or "Value2" or "Value3" then copy
C1 and related field A1 from worksheet 1 to worksheet 2 fields C1 and
A1 respectively.

If it doesn't equal "Value1" or "Value2 " or "Value3" don't do
anything.

The macro needs to read worksheet 1 all active cells from C2 on ????



If this is not clear please post for clarifying

Thanks
D



Danny[_2_]

if then multiple sheets and values
 
On Feb 6, 3:33*am, Joel wrote:
NewRowCount = 1
for each sh in thisworkbook.sheets
* *for rowCount = 1 to 1000
* * * if sh.range("A" & RowCount) = 5 and _
* * * * *sh.range("B" & RowCount) = 10 then

* * * * * * sh.rows(rowcount).copy *_
* * * * * * * destination:=Sheets("Summary").Rows(NewRowCount)
* * * * * * NewRowCount = NewRowCount + 1
* * * end if
* *next RowCount

next sh



"Danny" wrote:
I use ms excel 2002. *I have a workbook with multiple sheets. *I want
a macro that will look at all active cells and specific values in one
column say column C in *a worksheet1 and copy that cell and
corresponding A column cell to that C cell into another worksheet in
column A and C.


Example
Worksheet 1 if C1 value ="Value1" or "Value2" or "Value3" *then copy
C1 and related field A1 from worksheet 1 to worksheet 2 fields C1 and
A1 respectively.


If it doesn't equal "Value1" or "Value2 " or "Value3" don't do
anything.


The macro needs to read *worksheet 1 all active cells from C2 on ????


If this is not clear please post for clarifying


Thanks
D- Hide quoted text -


- Show quoted text -


Perfect thanks I will check out your code I really appreciate your
response.

D


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

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