0% found this document useful (0 votes)
446 views1 page

Copy Paste

This VBA code copies data from a range on the "AUTO TRAVEL TEMPLATE" worksheet if the value in cell G9 is not equal to "DATA EXIST". If G9 is not equal to "DATA EXIST", it copies the range A34:H34 on "AUTO TRAVEL TEMPLATE", pastes the values to the next empty row on the "DATA" worksheet, and displays a message that data was recorded. If G9 equals "DATA EXIST", it simply displays a message that data already exists.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
446 views1 page

Copy Paste

This VBA code copies data from a range on the "AUTO TRAVEL TEMPLATE" worksheet if the value in cell G9 is not equal to "DATA EXIST". If G9 is not equal to "DATA EXIST", it copies the range A34:H34 on "AUTO TRAVEL TEMPLATE", pastes the values to the next empty row on the "DATA" worksheet, and displays a message that data was recorded. If G9 equals "DATA EXIST", it simply displays a message that data already exists.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Sub copyPaste()

Dim verification As String


verification = Range("G9").Value

If verification = "DATA EXIST" Then


MsgBox ("Data Exist")
Else
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet

Set copySheet = Worksheets("AUTO TRAVEL TEMPLATE")


Set pasteSheet = Worksheets("DATA")

copySheet.Range("A34:H34").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial
xlPasteValues
Application.CutCopyMode = False
Application.ScreenUpdating = True

MsgBox ("Data Recorded!")


End If
End Sub

You might also like