lior03
08-10-2007, 11:57 AM
hello
i built a macro for a large data base.i wanted to merge two cells.
Dim lngRow As Long
Dim lngcom As Long
Dim firRow As Long
ActiveSheet.ResetAllPageBreaks
lngRow = ActiveSheet.Range("a1").End(xlDown).row
firRow = ActiveSheet.Range("a1").End(xlToRight).row
lngcom = ActiveSheet.Range("a1").End(xlToRight).Column
With Cells(lngRow + 2, lngcom - 2)
.clear
.Value = Format(Now, "dd/mm/yyyy hh:mm:ss dddd")
Range(Cells(lngRow + 2, lngcom - 2).Cells(lngRow + 2, lngcom - 3)).Merge
End With
With Cells(lngRow + 2, lngcom - 1)
.Value = "total items on list:"
With Cells(lngRow + 2, lngcom)
clear
.FormulaR1C1 = "=SUBTOTAL(3,(R2C:R[-1]C))"
.NUMBERFORMAT = "#,###0"
.Font.ColorIndex = 3
End With
With ActiveSheet.pagesetup
.CenterHorizontally = True
.PrintArea = "$A$2:" & Cells(lngRow + 2, lngcom).Address
.PrintTitleRows = "$A$1:" & Cells(firRow, lngcom).Address
.PrintGridlines = True
.Orientation = xlPortrait
.PrintComments = xlPrintInPlace
.CenterFooter = "&P of &N pages"
.CenterHeader = "&A" & "-" & "&F"
.RightFooter = ""
.RightHeader = ""
.LeftHeader = "&t" & Chr(13) & "&D"
.zoom = 90
End With
End With
Dim i As Integer
For i = 50 To Range("A1").End(xlDown).row Step 50
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Rows(i + 1)
Next i
i wanted the the date and hour cell be merge with rthe cell next to it from the left.i try to use the cell method .
thanks
i built a macro for a large data base.i wanted to merge two cells.
Dim lngRow As Long
Dim lngcom As Long
Dim firRow As Long
ActiveSheet.ResetAllPageBreaks
lngRow = ActiveSheet.Range("a1").End(xlDown).row
firRow = ActiveSheet.Range("a1").End(xlToRight).row
lngcom = ActiveSheet.Range("a1").End(xlToRight).Column
With Cells(lngRow + 2, lngcom - 2)
.clear
.Value = Format(Now, "dd/mm/yyyy hh:mm:ss dddd")
Range(Cells(lngRow + 2, lngcom - 2).Cells(lngRow + 2, lngcom - 3)).Merge
End With
With Cells(lngRow + 2, lngcom - 1)
.Value = "total items on list:"
With Cells(lngRow + 2, lngcom)
clear
.FormulaR1C1 = "=SUBTOTAL(3,(R2C:R[-1]C))"
.NUMBERFORMAT = "#,###0"
.Font.ColorIndex = 3
End With
With ActiveSheet.pagesetup
.CenterHorizontally = True
.PrintArea = "$A$2:" & Cells(lngRow + 2, lngcom).Address
.PrintTitleRows = "$A$1:" & Cells(firRow, lngcom).Address
.PrintGridlines = True
.Orientation = xlPortrait
.PrintComments = xlPrintInPlace
.CenterFooter = "&P of &N pages"
.CenterHeader = "&A" & "-" & "&F"
.RightFooter = ""
.RightHeader = ""
.LeftHeader = "&t" & Chr(13) & "&D"
.zoom = 90
End With
End With
Dim i As Integer
For i = 50 To Range("A1").End(xlDown).row Step 50
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Rows(i + 1)
Next i
i wanted the the date and hour cell be merge with rthe cell next to it from the left.i try to use the cell method .
thanks