If you want to save the filtered data in an array using VBA.
Here is the code-
Option Explicit
Sub store_filtered_data_in_array()
Application.DisplayAlerts = False
Dim ap As Workbook, i As Long
Dim z
' copy the filtered data
Sheets(1).Range("a1:c100").SpecialCells(xlCellTypeVisible).Copy
' add a new workbook
Set ap = Workbooks.Add
' paste data to new workbook
Range("a1").Select
ActiveSheet.Paste
' store data to an array
z = Range("a1:c" & Range("a1").End(xlDown).Row)
' close the new workbook without saving as we don't require it.
ap.Close
' use the data stored in an array
For i = LBound(z) To UBound(z)
MsgBox z(i, 1)
MsgBox z(i, 2)
MsgBox z(i, 3)
Next
Application.DisplayAlerts = True
End Sub
Subscribe to:
Post Comments (Atom)
Import data from SQL
Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...
-
Macro to Export Range in Json Format Option Explicit Sub export_in_json_format() Dim fs As Object Dim jsonfile Dim rangetoex...
-
If you want to run SQL queries within Excel environment without connecting to any database, you can do it with creating the ADODB conn...
Thant's owsome sharing. Like it.
ReplyDeleteDear kindly share some Examples on IE Automation as well.
Regards,Excelvba
check these links for ie automation
ReplyDeletehttp://www.jpsoftwaretech.com/excel-vba/automate-internet-explorer/
http://www.tushar-mehta.com/publish_train/xl_vba_cases/vba_web_pages_services/index.htm