Как указать непосредственный адрес на фаил находящийся в той-же папке...?
Програминг на ВБА
Страница: 1
Сообщений 1 страница 3 из 3
Поделиться22008-07-16 20:55:15
.\<имя файла>
или просто <имя файла> вроде как)
Поделиться32008-07-16 21:31:39
Код:
Sub Создание_общего_фаила() Application.ScreenUpdating = False [A2].FormulaR1C1 = "Дата выборки" [B2].FormulaR1C1 = "Директория" [E2].FormulaR1C1 = "Код СЦ 1-го ур." [F2].FormulaR1C1 = "Код СЦ конс." [G2].FormulaR1C1 = "Название СЦ" [I2].FormulaR1C1 = "Дата регистрации" [J2,M2,P2].FormulaR1C1 = "ЛО, группы" [K2,N2,Q2].FormulaR1C1 = "ОЛГ, группы" [L2,O2,R2].FormulaR1C1 = "ГО, группы" [C2].FormulaR1C1 = "№ региона" [D2].FormulaR1C1 = "Ф.И.О" [H2].FormulaR1C1 = "Регион" ' Pervoe ob'edinenie Range("J1:L1").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge [J1:L1].FormulaR1C1 = "За первый месяц" ' Vtoroe ob'edinenie Range("M1:O1").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge [M1:O1].FormulaR1C1 = "За второй месяц" ' Tret'e ob'edinenie Range("P1:R1").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge [P1:R1].FormulaR1C1 = "За третий месяц" 'Kopirovanie ph = ActiveWorkbook.Path Workbooks.Open Filename:=ph & "\" & "3.xls" Sheets("спис").Range("A8:I65530").Copy Windows("итог.xls").Activate Sheets(1).Select Range("A3").Select ActiveSheet.Paste ActiveSheet.Name = "спис" With ActiveSheet Dim Row1 As Long, Row2 As Long Row1 = ActiveWorkbook.ActiveSheet.UsedRange.Row Row2 = Row1 + ActiveWorkbook.ActiveSheet.UsedRange.Rows.Count - 1 End With Dim x As Integer Dim obl As Range Dim obl1 As Range Dim obl2 As Range With ActiveSheet For x = 3 To (Row2) Set obl1 = .Range("B" & x) Set obl = .Range("A" & x) Set obl2 = .Range("C" & x) obl.Select ActiveCell.FormulaR1C1 = "=CONCATENATE(obl1,obl2)" Next x End With End Sub
Страница: 1