0

I have this code in wich I add a sheet with a certain name and then I need to call this sheet to get a cell value but it doesn't assume.

Dim nome1 As String
Dim tableName As ListObject
Dim addedRow As ListRow

'To add a sheet with a specific name
nome1 = InputBox("Name of the sheet?")
Sheets.Add After:=ActiveSheet
ActiveSheet.Name = nome1

'For adding a row to table 1 and add value to the first cell
'The table1 is in a differente sheet then the sheet nome1

Set tableName = ActiveSheet.ListObjects("Table1")
Set addedRow = tableName.ListRows.Add()
With addedRow
    .Range(1) = "='nome1'!R1C3"
End With

'It doesn´t get the sheet with the variable 'nome1'!

2
  • 2
    Welcome! Do you lookup .Range(1) = "='" & nome1 & "'!R1C3"?
    – JohnSUN
    Commented Nov 28, 2022 at 11:23
  • Thank you very much Commented Nov 28, 2022 at 16:19

0

You must log in to answer this question.