D
Dan Kay
Hi,
I'm very new to VBA and am trying to do something that I'd think would be easy. I have a spreadsheet with information about employees calling absent for the day. I want to pull information from various columns in the active row, reorganize them into the clipboard to be pasted into another application.
The columns used are B, C, D, J, and K of the active row. Column K may be an empty cell on any given row.
Here is what I have so far...it doesn't like my activecell.row argument. I'm pasting the whole macro in case there are other errors in it:
Sub Copy()
'
'
'
Dim DOC As String ? Date of Call ? Column B
Dim PHN As String ? Phone Number ? Column C
Dim TOC As String ? Time of Call ? Column D
Dim EXN As String ? Exception ? Column J
Dim ACC As String ? Accommodations ? Column K
Dim RSN As String ? Reason ? derived from EXN
Dim PST As String ? Final data pasted toclipboard
? Assigning variables from the active row
DOC = (ActiveCell.Row): B
PHN = (ActiveCell.Row): C
TOC = (ActiveCell.Row): D
EXN = (ActiveCell.Row): J
ACC = (ActiveCell.Row): K
? Setting RSN based on EXN
If EXN = "L" Then
RSN = "Late"
ElseIf EXN = "E" Then
RSN = "Left Early"
ElseIf EXN = "M" Then
RSN = "Left and returned mid-shift"
ElseIf EXN = "F" Then
RSN = "Absent"
ElseIf EXN = "UPTO" Then
RSN = "Absent"
ElseIf EXN = "UNTU" Then
RSN = "Absent"
ElseIf EXN = "OTCNCL" Then
RSN = "Banker cancel OT"
End If
' Arranging final output to be pasted
PST = DOC & ", " & PHN & ", " & TOC & ", " & RSN & " " & ACC & " - "
? Loading output to the clipboard
PST.PutInClipboard
End Sub
Thank you in advance for any assistance!
I'm very new to VBA and am trying to do something that I'd think would be easy. I have a spreadsheet with information about employees calling absent for the day. I want to pull information from various columns in the active row, reorganize them into the clipboard to be pasted into another application.
The columns used are B, C, D, J, and K of the active row. Column K may be an empty cell on any given row.
Here is what I have so far...it doesn't like my activecell.row argument. I'm pasting the whole macro in case there are other errors in it:
Sub Copy()
'
'
'
Dim DOC As String ? Date of Call ? Column B
Dim PHN As String ? Phone Number ? Column C
Dim TOC As String ? Time of Call ? Column D
Dim EXN As String ? Exception ? Column J
Dim ACC As String ? Accommodations ? Column K
Dim RSN As String ? Reason ? derived from EXN
Dim PST As String ? Final data pasted toclipboard
? Assigning variables from the active row
DOC = (ActiveCell.Row): B
PHN = (ActiveCell.Row): C
TOC = (ActiveCell.Row): D
EXN = (ActiveCell.Row): J
ACC = (ActiveCell.Row): K
? Setting RSN based on EXN
If EXN = "L" Then
RSN = "Late"
ElseIf EXN = "E" Then
RSN = "Left Early"
ElseIf EXN = "M" Then
RSN = "Left and returned mid-shift"
ElseIf EXN = "F" Then
RSN = "Absent"
ElseIf EXN = "UPTO" Then
RSN = "Absent"
ElseIf EXN = "UNTU" Then
RSN = "Absent"
ElseIf EXN = "OTCNCL" Then
RSN = "Banker cancel OT"
End If
' Arranging final output to be pasted
PST = DOC & ", " & PHN & ", " & TOC & ", " & RSN & " " & ACC & " - "
? Loading output to the clipboard
PST.PutInClipboard
End Sub
Thank you in advance for any assistance!