Jessica553
New Member
- Joined
- Nov 21, 2021
- Messages
- 24
- Office Version
- 2010
- Platform
- Windows
Hello, I found this code online and have used it to create a list of new worksheets and pick up the information from specific cells - in this case B13.
I want to amend it so that I can also pick up A2 and pull the result into Sheet1 (Asset List) next to the result from B13. But I don't know where to begin.
This is what I want the result to be in the sheet 'Asset List'. I have the 'Asset Info Sheet 1' in A2 working and the $800 in B2 comes through from it's sheet (B13 on its sheet) but I want the 305562 to come through as well also from B13. Hope that makes sense.
Thank you in advance, I am very new and learn as I go so not sure what all the bits mean.
CODE:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Not Intersect(Target, Sh.Range("B13")) Is Nothing Then
Dim ws As Worksheet
Set ws = Sheets("Asset List")
Dim iRow As Integer
On Error GoTo Yikes:
TryAgain:
iRow = Application.WorksheetFunction.Match(Sh.Name, ws.Range("A1:A50"), 0)
ws.Cells(iRow, 2) = Target.Value
Exit Sub
Yikes:
Dim rowcount As Integer
rowcount = ws.Cells(Rows.Count, 1).End(xlUp).Row
Dim r As Range
Set r = ws.Cells(rowcount + 1, 1)
r = Sh.Name
GoTo TryAgain:
End If
End Sub
I want to amend it so that I can also pick up A2 and pull the result into Sheet1 (Asset List) next to the result from B13. But I don't know where to begin.
This is what I want the result to be in the sheet 'Asset List'. I have the 'Asset Info Sheet 1' in A2 working and the $800 in B2 comes through from it's sheet (B13 on its sheet) but I want the 305562 to come through as well also from B13. Hope that makes sense.
Thank you in advance, I am very new and learn as I go so not sure what all the bits mean.
Capitalisation Value | Asset Number | |
Asset Info Sheet 1 | $800.00 | 305562 |
CODE:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Not Intersect(Target, Sh.Range("B13")) Is Nothing Then
Dim ws As Worksheet
Set ws = Sheets("Asset List")
Dim iRow As Integer
On Error GoTo Yikes:
TryAgain:
iRow = Application.WorksheetFunction.Match(Sh.Name, ws.Range("A1:A50"), 0)
ws.Cells(iRow, 2) = Target.Value
Exit Sub
Yikes:
Dim rowcount As Integer
rowcount = ws.Cells(Rows.Count, 1).End(xlUp).Row
Dim r As Range
Set r = ws.Cells(rowcount + 1, 1)
r = Sh.Name
GoTo TryAgain:
End If
End Sub