Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
two criteria to match
Hello, appreciate your help...
- I am trying to populate Cell A, B, F and H in Sheet B into cells in Sheet A starting from G3 in Sheet A. - There is data already populated from Cell A3 to Cell F in Sheet A. - If content in Cell S in Sheet B and content in Cell E in Sheet A as well as content in Cell D in Sheet B and content in Cell C in Sheet A matche, contents in Cell A, B, F and H in Sheet B need to be populated starting from Cell G3 in Sheet A. How can I do this? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
two criteria to match
RowCount = 3
with sheets("Sheet A") if (.Range("E" & RowCount) = sheets("Sheet B").Range("S" & RowCount)) and _ (.Range("C" & RowCount) = sheets("Sheet B").Range("D" & RowCount)) .Range("G" & RowCount).value = sheets("Sheet B").Range("A" & RowCount).value .Range("H" & RowCount).value = sheets("Sheet B").Range("B" & RowCount).value .Range("I" & RowCount).value = sheets("Sheet B").Range("F" & RowCount).value .Range("J" & RowCount).value = sheets("Sheet B").Range("H" & RowCount).value "nk" wrote: Hello, appreciate your help... - I am trying to populate Cell A, B, F and H in Sheet B into cells in Sheet A starting from G3 in Sheet A. - There is data already populated from Cell A3 to Cell F in Sheet A. - If content in Cell S in Sheet B and content in Cell E in Sheet A as well as content in Cell D in Sheet B and content in Cell C in Sheet A matche, contents in Cell A, B, F and H in Sheet B need to be populated starting from Cell G3 in Sheet A. How can I do this? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
two criteria to match
Thank you, Joel... but I can't make it work receiving an error message
"compile error: expected: expression". I tried to find addition "then" "end with" etc, but could not figure out what is the problem... "Joel" wrote: RowCount = 3 with sheets("Sheet A") if (.Range("E" & RowCount) = sheets("Sheet B").Range("S" & RowCount)) and _ (.Range("C" & RowCount) = sheets("Sheet B").Range("D" & RowCount)) .Range("G" & RowCount).value = sheets("Sheet B").Range("A" & RowCount).value .Range("H" & RowCount).value = sheets("Sheet B").Range("B" & RowCount).value .Range("I" & RowCount).value = sheets("Sheet B").Range("F" & RowCount).value .Range("J" & RowCount).value = sheets("Sheet B").Range("H" & RowCount).value "nk" wrote: Hello, appreciate your help... - I am trying to populate Cell A, B, F and H in Sheet B into cells in Sheet A starting from G3 in Sheet A. - There is data already populated from Cell A3 to Cell F in Sheet A. - If content in Cell S in Sheet B and content in Cell E in Sheet A as well as content in Cell D in Sheet B and content in Cell C in Sheet A matche, contents in Cell A, B, F and H in Sheet B need to be populated starting from Cell G3 in Sheet A. How can I do this? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
two criteria to match
The "THEN" was missing ffrom the IF statemnt. I also added the line
continuation character ("_") to the long lines and put in the "end with". this is only partial code, I'm assuming you have written the rest of the macro. RowCount = 3 With Sheets("Sheet A") If (.Range("E" & RowCount) = Sheets("Sheet B").Range("S" & RowCount)) And _ (.Range("C" & RowCount) = Sheets("Sheet B").Range("D" & RowCount)) Then .Range("G" & RowCount).Value = _ Sheets("Sheet B").Range("A" & RowCount).Value .Range("H" & RowCount).Value = _ Sheets("Sheet B").Range("B" & RowCount).Value .Range("I" & RowCount).Value = _ Sheets("Sheet B").Range("F" & RowCount).Value .Range("J" & RowCount).Value = _ Sheets("Sheet B").Range("H" & RowCount).Value End With "nk" wrote: Thank you, Joel... but I can't make it work receiving an error message "compile error: expected: expression". I tried to find addition "then" "end with" etc, but could not figure out what is the problem... "Joel" wrote: RowCount = 3 with sheets("Sheet A") if (.Range("E" & RowCount) = sheets("Sheet B").Range("S" & RowCount)) and _ (.Range("C" & RowCount) = sheets("Sheet B").Range("D" & RowCount)) .Range("G" & RowCount).value = sheets("Sheet B").Range("A" & RowCount).value .Range("H" & RowCount).value = sheets("Sheet B").Range("B" & RowCount).value .Range("I" & RowCount).value = sheets("Sheet B").Range("F" & RowCount).value .Range("J" & RowCount).value = sheets("Sheet B").Range("H" & RowCount).value "nk" wrote: Hello, appreciate your help... - I am trying to populate Cell A, B, F and H in Sheet B into cells in Sheet A starting from G3 in Sheet A. - There is data already populated from Cell A3 to Cell F in Sheet A. - If content in Cell S in Sheet B and content in Cell E in Sheet A as well as content in Cell D in Sheet B and content in Cell C in Sheet A matche, contents in Cell A, B, F and H in Sheet B need to be populated starting from Cell G3 in Sheet A. How can I do this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
sum for match criteria | Excel Worksheet Functions | |||
Count how many criteria in a column match criteria in another colu | Excel Discussion (Misc queries) | |||
Match criteria with an array of criteria | Excel Worksheet Functions | |||
MATCH Multiple Criteria & Return Previous / Penultimate Match | Excel Worksheet Functions | |||
match multiple criteria ina range from multiple criteria multiplet | Excel Worksheet Functions |