babulalgandhi
New Member
- Joined
- Feb 5, 2015
- Messages
- 12
Hi friends I am new to macro.
I am trying to pull data from webpage like name, contact no. And address in excel. if I put webpage links in Column A1,A2,A3... And So On. The output data Will Avalable in B1 as Company Name, C1 as Address, D1 as Contact Mobile1, E1 as Contact Mobile2, F1 as Contact Mobile3, G1 as Contact Mobile4, H1 as Contact Telephone1, I1 as Contact Telephone1, J1 as Contact Telephone1, K1 as Contact Telephone1, and L1 as Website.
Thanks in advance for your help.
I Am Trying From 5 Day's And I Learn Watching Youtube Video Of Dinesh Kumar Takyar And
Learned From These Friends Posts In Other Members Thread's
Excel Help Forum
User Kyle - Stack Overflow
http://www.mrexcel.com/forum/members/ukmikeb.html
User dee - Stack Overflow
Free Excel\VBA Help Forum
User omegastripes - Stack Overflow
http://www.mrexcel.com/forum/members/john_w.html
Thanks You All For UR Posts My Teachers
Sub Macro1()
'
' Macro1 Macro
' Formatting imported data
'
'
Columns("A:F").Select
Selection.Columns.AutoFit
With Selection
.VerticalAlignment = xlTop
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
End With
Range("F1").Select
Columns("F:F").ColumnWidth = 50
Columns("A:F").Select
Selection.Rows.AutoFit
End Sub
Sub test()
Dim eRow As Long
Dim ele As Object
Set sht = Sheets("Sheet1")
RowCount = 1
sht.Range("A" & RowCount) = "Company"
sht.Range("B" & RowCount) = "Location"
sht.Range("C" & RowCount) = "Mobile"
sht.Range("D" & RowCount) = "Telephone"
sht.Range("E" & RowCount) = "Website"
sht.Range("F" & RowCount) = "Fax"
eRow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.Visible = False
.Navigate "http://www.justdial.com/Mumbai/Tiles-Styles-India-Pvt-Ltd-%3Cnear%3E-Behind-Glaxo-Worli-Colony-Worli-New/022PXX22-XX22-120319115535-K7W9_TXVtYmFpIFRpbGUgRGVhbGVycyBXaXRoIEVtYWlsIEFkZHJlc3M=_BZDET"
Do Until .ReadyState = 4: DoEvents: Loop
For Each ele In .document.all
Select Case ele.classname
Case "Result"
RowCount = RowCount + 1
Case "ghd"
sht.Range("A" & RowCount+1) = ele.innertext
Case "jaddt"
sht.Range("B" & RowCount+1) = ele.innertext
Case "jmob"
sht.Range("C" & RowCount+1) = ele.innertext
Case "jtel"
sht.Range("D" & RowCount+1) = ele.innertext
Case "wsurl"
sht.Range("E" & RowCount+1) = ele.innertext
Case "jfax"
sht.Range("F" & RowCount+1) = ele.innertext
End Select
Next ele
End With
Macro1
Set objIE = Nothing
End Sub
I am trying to pull data from webpage like name, contact no. And address in excel. if I put webpage links in Column A1,A2,A3... And So On. The output data Will Avalable in B1 as Company Name, C1 as Address, D1 as Contact Mobile1, E1 as Contact Mobile2, F1 as Contact Mobile3, G1 as Contact Mobile4, H1 as Contact Telephone1, I1 as Contact Telephone1, J1 as Contact Telephone1, K1 as Contact Telephone1, and L1 as Website.
Thanks in advance for your help.
I Am Trying From 5 Day's And I Learn Watching Youtube Video Of Dinesh Kumar Takyar And
Learned From These Friends Posts In Other Members Thread's
Excel Help Forum
User Kyle - Stack Overflow
http://www.mrexcel.com/forum/members/ukmikeb.html
User dee - Stack Overflow
Free Excel\VBA Help Forum
User omegastripes - Stack Overflow
http://www.mrexcel.com/forum/members/john_w.html
Thanks You All For UR Posts My Teachers
Sub Macro1()
'
' Macro1 Macro
' Formatting imported data
'
'
Columns("A:F").Select
Selection.Columns.AutoFit
With Selection
.VerticalAlignment = xlTop
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
End With
Range("F1").Select
Columns("F:F").ColumnWidth = 50
Columns("A:F").Select
Selection.Rows.AutoFit
End Sub
Sub test()
Dim eRow As Long
Dim ele As Object
Set sht = Sheets("Sheet1")
RowCount = 1
sht.Range("A" & RowCount) = "Company"
sht.Range("B" & RowCount) = "Location"
sht.Range("C" & RowCount) = "Mobile"
sht.Range("D" & RowCount) = "Telephone"
sht.Range("E" & RowCount) = "Website"
sht.Range("F" & RowCount) = "Fax"
eRow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.Visible = False
.Navigate "http://www.justdial.com/Mumbai/Tiles-Styles-India-Pvt-Ltd-%3Cnear%3E-Behind-Glaxo-Worli-Colony-Worli-New/022PXX22-XX22-120319115535-K7W9_TXVtYmFpIFRpbGUgRGVhbGVycyBXaXRoIEVtYWlsIEFkZHJlc3M=_BZDET"
Do Until .ReadyState = 4: DoEvents: Loop
For Each ele In .document.all
Select Case ele.classname
Case "Result"
RowCount = RowCount + 1
Case "ghd"
sht.Range("A" & RowCount+1) = ele.innertext
Case "jaddt"
sht.Range("B" & RowCount+1) = ele.innertext
Case "jmob"
sht.Range("C" & RowCount+1) = ele.innertext
Case "jtel"
sht.Range("D" & RowCount+1) = ele.innertext
Case "wsurl"
sht.Range("E" & RowCount+1) = ele.innertext
Case "jfax"
sht.Range("F" & RowCount+1) = ele.innertext
End Select
Next ele
End With
Macro1
Set objIE = Nothing
End Sub