Makro für 4 Blätter
24.05.2024 12:57:21
Christian
Ich habe folgendes Makro gefunden, was auch zu 99% meinen Zweck erfüllt. Nur eine ganz blöde Frage,
wie schaffe ich es, dass dieses Makro nacheinander in Tabelle1, Tabelle2, Tabelle3 und Tabelle4 ausgeführt wird?
Musste es auf 4 Blätter aufteilen, da ansonsten die ca. 1 Mio Zeilen pro Spalte nicht ausreichen.
Geht doch bestimmt auch einfacher, als das Makro 4mal untereinander zu kopieren und jedesmal das Sheet zu ändern
Public Sub test()
Dim objIE As Object
Dim objLinks As Object
Dim objLink As Object
Dim lngCount As Long
Dim lloRow As Long, lshTab2 As Worksheet
Set lshTab2 = Sheets("Tabelle1")
For lloRow = 1 To lshTab2.Cells(lshTab2.Rows.Count, 1).End(xlUp).Row
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.navigate lshTab2.Range("A" & lloRow).Text
Do While .busy
Do While .busy
DoEvents
Loop
Loop
.Visible = False
Set objLinks = .Document.Links
For Each objLink In objLinks
lngCount = lngCount + 1
lshTab2.Cells(lngCount, 2) = objLink.href
lshTab2.Cells(lngCount, 3) = "'" & objLink.outertext
Next
.Quit
End With
Application.Wait ("00:00:05")
Next
Set objIE = Nothing
Set lshTab2 = Nothing
End Sub
Anzeige