Can anyone tell me how to write a VBA code to run an IF statement that says IF sheet1!A1 and A2 and A3 match Sheet2!A1, A2, and A3 the cut and paste Sheet2!A4 into sheet1!a4. If that makes since to anyone.
Can anyone tell me how to write a VBA code to run an IF statement that says IF sheet1!A1 and A2 and A3 match Sheet2!A1, A2, and A3 the cut and paste Sheet2!A4 into sheet1!a4. If that makes since to anyone.
[vba]
Set sh = Worksheets("Sheet2")
With Worksheets("Sheet1")
If .Range("A1").Value = sh.Range("A1").Value And _
.Range("A2").Value = sh.Range("A2").Value And _
.Range("A3").Value = sh.Range("A3").Value Then
.Range("A4").Copy sh.Range("A4")
End If
End With
[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
you can use folowing code:
[VBA]Sub CopyPaste()
For i = 1 To 3
If Sheets("Sheet1").Cells(i, 1).Value = Sheets("Sheet2").Cells(i, 1).Value Then
Else
Exit Sub
End If
Next i
Sheets("Sheet2").Range("A4").Cut
Sheets("Sheet1").Range("A4").Insert
End Sub[/VBA]
Did not recognize the date to match. Any other ideas.
I have this VLOOKUP in Row H === =IF(IF(ISERROR(VLOOKUP(A1912,Data_2!$B$1:$L$57570,9,FALSE)),"None",VLOOKUP( A1912,Data_2!$B$1:$L$57570,9,FALSE))=0,"None",IF(ISERROR(VLOOKUP(A1912,Data _2!$B$1:$L$57570,9,FALSE)),"None",VLOOKUP(A1912,Data_2!$B$1:$L$57570,9,FALS E))). I just want to atleast put it in VBA but paste it in H.
what do you mean by that??Did not recognize the date to match. Any other ideas.
I am not sure what you are asking, but can't you simplify that formula to
=IF(ISERROR(VLOOKUP(A1912,Data_2!$B$1:$L$57570,9,FALSE)),"None",
IF(VLOOKUP(A1912,Data_2!$B$1:$L$57570,9,FALSE)=0,"None",VLOOKUP(A1912,Data_ 2!$B$1:$L$57570,9,FALSE)))
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
It would not return a copy paste. The dates are exactly the same.
Isn't that what you wanted??
Compare A1 A2 A3 from Sheet 1 with A1 A2 A3 from Sheet 2.
If they are the same cut A4 from Sheet 2 to Sheet 1 but
if not don't do anything.
MaximS is 100% correct. But in a macro or VBA form. I can record a macro to copy paste but I can not get the long VLOOKUP to work with it. That is what I am looking to do.
Would you like to restate your problem again, from the start, completely, accurately, and in detail, as we have answered the question that you asked, and now you have introduced a new factor whilst that the solution ... did not match.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Sample file should give us more information.
What I need is to take the data from Data_1 page and seperate on the first three pages.
Date IS shows only the date issued. Date PD only shows those with date paid. And Date STP shows only those from
Date stop. Only when that is complete I want to take the data_1 and erase it. Then take Data_2 and match date, check #,
and amount with a vlookup. If matches and pastes the address from ADRess from DATA_2 onto the first three sheets. and
delete the information. Then when I go to add my next check book information in there it pastes the new stuff
from DATA_1 below the previous. Can any one help on this. It is to help balance my bills. Rows on all 5 tabs is A-H 1-60000. I have this VLOOKUP in Row H === =IF(IF(ISERROR(VLOOKUP(A1912,Data_2!$B$1:$L$57570,9,FALSE)),"None",VLOOKUP( A1912,Data_2!$B$1:$L$5757 0,9,FALSE))=0,"None",IF(ISERROR(VLOOKUP(A1912,Data_2!$B$1:$L$57570,9,FALSE) ),"None",VLOOKUP(A1912,Data_2!$B$1:$L$57570,9,FALSE))). I want it in VBA code. And I can not attach the excel file here.
Here is the file
try this attachment I hope it's exactly what you want.