Prilozenou proceduru vloz v editoru VBA (Alt+F11) do standardniho modulu, uprav ci dopln radky pro dalsi prenasene bunky vcetne upravy ofsetu.
Volat z karty Vyvojar>Makra nebo v editoru VBA klavesa F5.
Over na kopii sesitu, testovano v Excelu 2007.
Kód: Vybrat vše
Option Explicit
Sub NacistZListu()
Dim TCll As Range
Dim TOfsR As Long
Dim SWsht As Worksheet, SCll As Range
Set TCll = Worksheets("adresáø").Range("b2") ' vychozi cilova bunka
' prochaze vsechny listy mimo list adresar
For Each SWsht In ActiveWorkbook.Worksheets
If SWsht.Name <> "adresáø" Then
Set SCll = SWsht.Range("a1")
TCll.Offset(TOfsR, 0).Value = SCll.Offset(3, 0).Value ' nazev
TCll.Offset(TOfsR, 1).Value = Odstran(SCll.Offset(11, 0).Value) ' tlf
TCll.Offset(TOfsR, 2).Value = SCll.Offset(6, 0).Value ' adresa
TCll.Offset(TOfsR, 3).Value = Odstran(SCll.Offset(10, 0).Value) ' e-mail
TCll.Offset(TOfsR, 4).Value = Odstran(SCll.Offset(9, 0).Value) ' reditel/ka
TCll.Offset(TOfsR, 5).Value = Odstran(SCll.Offset(10, 1).Value) ' web
' dalsi bunka: vloz radek
'TCll.Offset(TOfsR, xx).Value = SCll.Offset(yy, zz).Value
' a podle cile uprav sloupcovy ofset xx a podle zdroje ofset radku yy a sloupce zz
TOfsR = TOfsR + 1 ' ofset pro dalsi list
End If
Next SWsht
Worksheets("adresáø").UsedRange.Columns.AutoFit
' odstranit objektove promenne
Set TCll = Nothing
Set SCll = Nothing
Set SWsht = Nothing
End Sub
Private Function Odstran(Str As String)
' odstrani cast pred ":" (dvojteckou)
Odstran = Right(Str, Len(Str) - InStr(Str, ":"))
End Function