moradisndat
New Member
- Joined
- Feb 19, 2021
- Messages
- 15
- Office Version
- 2007
- Platform
- Windows
I was hoping to get a confirmation if I am doing this correctly. (Using variable to refer to sheet)
After importing a large CSV file to sheet1, several actions are performed, mostly using "range." (Delete rows with blank cells, formatting, inserting columns for formulas, assigning named ranges, etc)
It looks like this:
---------------------
Dim ws as worksheet
Set ws = ActiveWorkbook.Sheets(Sheet1)
With ws
.Range("E1").EntireColumn.Insert
.Range("A1:G3").Columns.AutoFit
' and so on
End with
-----------------------
Also, could I use ws in place of using Sheets(Sheet1) to import the file?
With ws.QueryTables.Add(Connection:= _
"TEXT;" & path, Destination:=Range("$A$1"))
Kinda new to this so appreciate any help. Thanks in advance.
After importing a large CSV file to sheet1, several actions are performed, mostly using "range." (Delete rows with blank cells, formatting, inserting columns for formulas, assigning named ranges, etc)
It looks like this:
---------------------
Dim ws as worksheet
Set ws = ActiveWorkbook.Sheets(Sheet1)
With ws
.Range("E1").EntireColumn.Insert
.Range("A1:G3").Columns.AutoFit
' and so on
End with
-----------------------
Also, could I use ws in place of using Sheets(Sheet1) to import the file?
With ws.QueryTables.Add(Connection:= _
"TEXT;" & path, Destination:=Range("$A$1"))
Kinda new to this so appreciate any help. Thanks in advance.