I have the following VBA line:
tsheet.Range("N" & x).Value = WorksheetFunction.IfNa(Application.Index(ssheet.Range("I2:I" & Sourcelastrow), _
Application.Match(tsheet.Range("G" & x).Value & " " & tsheet.Range("H" & x).Value, _
ssheet.Range("U2:U" & Sourcelastrow), 0)), "")
Where:
tsheet = workbook1, sheet1 (target sheet)
ssheet = workbook2, sheet1 (source sheet)
x = a for/next loop cycling through all the rows in tsheet
slastrow = last row # in ssheet
Goal:
if we find a match from ssheet.range in tsheet.range, then instead of just filling in tsheet.range("N") & x).value), I want to start an if/then loop
The above statement works, in that it does fill in the single cell when a match is found, but I need to do a couple more things, so hoping I can start the if/then, but I have tried a few things w/o success. Any ideas?
Secondarily (or bonus Q... : in the above statement, the IFNA has the option of putting an alternate value into tsheet.range("N") & x).value), which I currently have set to "". This is causing an issue in that excel is interpreting that as "0" (zero), when what I actually want is an empty cell. Is there something I can put in there instead that would make it just empty?
Thank you so much!!
-randy
tsheet.Range("N" & x).Value = WorksheetFunction.IfNa(Application.Index(ssheet.Range("I2:I" & Sourcelastrow), _
Application.Match(tsheet.Range("G" & x).Value & " " & tsheet.Range("H" & x).Value, _
ssheet.Range("U2:U" & Sourcelastrow), 0)), "")
Where:
tsheet = workbook1, sheet1 (target sheet)
ssheet = workbook2, sheet1 (source sheet)
x = a for/next loop cycling through all the rows in tsheet
slastrow = last row # in ssheet
Goal:
if we find a match from ssheet.range in tsheet.range, then instead of just filling in tsheet.range("N") & x).value), I want to start an if/then loop
The above statement works, in that it does fill in the single cell when a match is found, but I need to do a couple more things, so hoping I can start the if/then, but I have tried a few things w/o success. Any ideas?
Secondarily (or bonus Q... : in the above statement, the IFNA has the option of putting an alternate value into tsheet.range("N") & x).value), which I currently have set to "". This is causing an issue in that excel is interpreting that as "0" (zero), when what I actually want is an empty cell. Is there something I can put in there instead that would make it just empty?
Thank you so much!!
-randy