Skip to main content

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

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'!

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'!

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'!

Source Link

Call a sheet using a variable name

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'!