TopLearner
Board Regular
- Joined
- Feb 25, 2022
- Messages
- 57
- Office Version
- 365
- Platform
- Windows
Good afternoon,
I hope you are all well.
I have a spreadsheet with a tab called "summary" and a range D18:G18 with data on it.
I am trying to convert it into a table by writing a code but it does not work. I have tried two different approaches but they do not work.
This is giving me this error: "Run-time error '5: Invalid procedure call or argument
Then, I try another one
And, I get the same error
"Run-time error '5: Invalid procedure call or argument
Can you please help?
Thanks
Sanchez
I hope you are all well.
I have a spreadsheet with a tab called "summary" and a range D18:G18 with data on it.
I am trying to convert it into a table by writing a code but it does not work. I have tried two different approaches but they do not work.
VBA Code:
Sub ConvertirRangoenTabla()
Dim Rango As Range
Dim Hoja As Worksheet
Set Rango = Worksheets("Summary").UsedRange
Set Hoja = ActiveSheet
Hoja.ListObjects.Add(SourceType:=XlRangoRange, Source:=Rango, xlListObjectHasHeaders:=xlYes, tablestyleName:="TableStyleMedium28").Name = "Summary"
End Sub
This is giving me this error: "Run-time error '5: Invalid procedure call or argument
Then, I try another one
VBA Code:
Sub ConvertirRangoenTablaII()
Dim Rango As Range
Dim Hoja As Worksheet
Set Rango = Range("D3").CurrentRegion
Set Hoja = ActiveSheet
Hoja.ListObjects.Add(SourceType:=XlRangoRange, Source:=Rango, xlListObjectHasHeaders:=xlYes, tablestyleName:="TableStyleMedium28").Name = "Summary"
End Sub
And, I get the same error
"Run-time error '5: Invalid procedure call or argument
Can you please help?
Thanks
Sanchez