dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,392
- Office Version
- 365
- 2016
- Platform
- Windows
I have a spreadsheet that works fine. I adds names of young people to a list in another sheet. I want to change it to store the names in another workbook.
This is my code that works,
I wanted to add code that will open a spreadsheet to list the names in instead of another sheet but what is wrong with my code as it highlights the "&" in the 4th line and says type mismatch?
This is my code that works,
VBA Code:
Sub AddYP()
Application.DisplayAlerts = False
Dim newyp As String
newyp = Tracker.Cells(5, 4)
YP.Range("A" & Rows.Count).End(xlUp).Offset(1, 0) = newyp
Call CreateWB(newyp)
Application.DisplayAlerts = True
ThisWorkbook.Names.Add Name:="tblYPNames", _
RefersTo:=Range("tblYPNames").Resize(Range("tblYPNames").Rows.Count + 1)
End Sub
I wanted to add code that will open a spreadsheet to list the names in instead of another sheet but what is wrong with my code as it highlights the "&" in the 4th line and says type mismatch?
VBA Code:
Sub AddYP()
Application.DisplayAlerts = False
Dim AddListWB As Workbook
Set AddListWB = ThisWorkbook.Path & "\Young People\List.xlsm"
Dim newyp As String
newyp = Tracker.Cells(5, 4)
YP.Range("A" & Rows.Count).End(xlUp).Offset(1, 0) = newyp
Call CreateWB(newyp)
Application.DisplayAlerts = True
ThisWorkbook.Names.Add Name:="tblYPNames", _
RefersTo:=Range("tblYPNames").Resize(Range("tblYPNames").Rows.Count + 1)
End Sub