Hi I have previously managed to copy and paste cells from one worksheet (named: Form) to another Worksheet (selected in Cell C4).
this is my current code and screenshot:
Form: Picture 1
Tabs: Picture 2
Any help is much appreciated.
this is my current code and screenshot:
VBA Code:
Sub Copy_Data()
Dim hh As Worksheet, exist As Boolean, h As Worksheet, sh As Worksheet
Dim f As Range
Set hh = Sheets("Form")
If hh.Range("C4") = "" Then
MsgBox "Enter Hospital", vbCritical
Exit Sub
End If
If hh.Range("C5") = "" Then
MsgBox "Enter Ward", vbCritical
Exit Sub
End If
exist = False
For Each h In Sheets
If LCase(h.Name) = LCase(hh.Range("C4").Value) Then
Set sh = h
exist = True
Exit For
End If
Next
If exist = False Then
MsgBox "The sheet does not exist", vbCritical
Exit Sub
End If
Next
'Copy Responses to Data'
'cell destination cell origin
Copy.Paste hh.Range("C4:C25") = sh.Cells(f.Row, "A:V")
'copy Resposes IF Urinary Tract IS SELECTED'
'copy Reposes to the Sites Selected on the form cell C4'
'then give message'
If MsgBox("Form Successfully Submitted!") Then
End If
End Sub
Form: Picture 1
Tabs: Picture 2
Any help is much appreciated.