Ok I'm no pro when it comes to VBA, I generally copy and paste code and basically try and figure out what means what by trial and error but for the life of me I have zero idea how to fix this.
In a nut shell I have a sheet that when I select any part of Range("B10:F34") it selects the given nCell and pastes it below but what I want is if the Range has certain text values such as "Aprrentice" or "Master" I want it "GoTo" the Labour section (I havent compiled anything there yet but it keeps giving me "End If without block If compile error" why....???
In a nut shell I have a sheet that when I select any part of Range("B10:F34") it selects the given nCell and pastes it below but what I want is if the Range has certain text values such as "Aprrentice" or "Master" I want it "GoTo" the Labour section (I havent compiled anything there yet but it keeps giving me "End If without block If compile error" why....???
VBA Code:
Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myCell As Range
Dim myRange As Range
Set nCell = Rows(ActiveCell.Row).Columns(2).Resize(1, 5)
Set r2 = Sheets("Form").Range("B75").End(xlUp).Offset(1, 0)
Set Rng = Range("B10:B35")
If Selection.Count = 1 Then
If Not Intersect(Target, Range("B10:F34")) Is Nothing Then
For Each myCell In Rng
If myCell Like "*Apprentice*" Or _
myCell Like "*Master*" Or _
myCell Like "*Tradesman*" Then
Goto Labour
nCell.Copy
r2.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
ThisWorkbook.Save
End If
End If
Labour:
Next myCell
End Sub