Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
NK NK is offline
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
NK NK is offline
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
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
sum for match criteria Neall Excel Worksheet Functions 6 June 9th 09 12:13 PM
Count how many criteria in a column match criteria in another colu Charles Stover Excel Discussion (Misc queries) 3 March 6th 09 08:39 PM
Match criteria with an array of criteria JohnB Excel Worksheet Functions 4 November 18th 08 10:56 PM
MATCH Multiple Criteria & Return Previous / Penultimate Match Sam via OfficeKB.com Excel Worksheet Functions 27 October 6th 07 01:39 AM
match multiple criteria ina range from multiple criteria multiplet RG Excel Worksheet Functions 8 September 28th 07 04:21 AM


All times are GMT +1. The time now is 08:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"