I have connected excel with mssql 2008 database and now the data is filled into excel but it is not a table. I want to create a table automatically when the data load.I have used
where xlWs is excel worksheet
Sub CreateTable(ByRef xlWs As Object)
xlWs.ListObjects.Add(xlSrcRange, , , xlYes).Name = _
"Table1"
'No go in 2003
xlWs.ListObjects("Table1").TableStyle = "TableStyleLight2"
End Subs into excel.
To make the data into table but it does not display any range dialog as it would do if I would create table using GUI. How to display such dialog?
You cannot display the built in range dialog, but you can display a dialog box that asks for a range like this:
Dim ThisRng As Range
Set ThisRng = Application.InputBox("Select a range", "Get Range", Type:=8)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With