K
keith2816
Hi there,
Currently I have the following macro that I will run after extractin
sorted result from some external software.
This macro will lookup certain text value from certain cell and perfor
some simple adjustment on the worksheet and finally adding page brea
and print function so that each fund will be on a fresh page durin
printing
e.g Sub GroupTrade()
Set Trx = Range("D5")
Set FUND = Range("A5")
Do While Not IsEmpty(Trx)
Set nextFUND = FUND.Offset(1, 0)
Set nextTrx = Trx.Offset(1, 0)
If nextTrx.Value Like "Count*" Then
Trx.Offset(1, 0).EntireRow.Font.Bold = True
Trx.Offset(2, 0).EntireRow.Insert Shift:=xlDown
Trx.Offset(2, 0).EntireRow.Font.Size = 20
Set nextTrx = Trx.Offset(3, 0)
Set nextFUND = FUND.Offset(3, 0)
If nextTrx.Value Like "FUND*" Then
Trx.Offset(3, 0).EntireRow.Font.Bold = True
Trx.Offset(3, -3).Value = RTrim(nextFUND) & " : " & Mid(nextTrx
8, 6) & " trades"
Range(Trx.Offset(3, -2), Trx.Offset(3, 1)).Select
Selection.ClearContents
Range(Trx.Offset(3, -3), Trx.Offset(3, 1)).Select
Selection.ClearFormats
With Selection
.Font.Size = 10
.Font.Underline = False
.WrapText = True
.Orientation = 0
.RowHeight = 30
.VerticalAlignment = xlBottom
.ShrinkToFit = False
.Borders(xlEdgeBottom).Weight = xlHairline
.MergeCells = True
End With
Set nextTrx = Trx.Offset(4, 0)
Set nextFUND = FUND.Offset(4, 0)
Set Anymore = Trx.Offset(5, 0)
If Not IsEmpty(Anymore) Then
ActiveWindow.SelectedSheets.HPageBreaks.Ad
Before:=nextTrx
End If
End If
End If
Set Trx = nextTrx
Set FUND = nextFUND
Loop
End Sub
However, I need help as in currently I wanted to set one conditio
whereby, when there's a condition that match the 'Fund*' condition,
will like to copy the name of the fund and paste it at the first empt
cell from the top of the worksheet.
thus the eventual print report will be pages of different fund name a
the said cell.
pls help thk
Currently I have the following macro that I will run after extractin
sorted result from some external software.
This macro will lookup certain text value from certain cell and perfor
some simple adjustment on the worksheet and finally adding page brea
and print function so that each fund will be on a fresh page durin
printing
e.g Sub GroupTrade()
Set Trx = Range("D5")
Set FUND = Range("A5")
Do While Not IsEmpty(Trx)
Set nextFUND = FUND.Offset(1, 0)
Set nextTrx = Trx.Offset(1, 0)
If nextTrx.Value Like "Count*" Then
Trx.Offset(1, 0).EntireRow.Font.Bold = True
Trx.Offset(2, 0).EntireRow.Insert Shift:=xlDown
Trx.Offset(2, 0).EntireRow.Font.Size = 20
Set nextTrx = Trx.Offset(3, 0)
Set nextFUND = FUND.Offset(3, 0)
If nextTrx.Value Like "FUND*" Then
Trx.Offset(3, 0).EntireRow.Font.Bold = True
Trx.Offset(3, -3).Value = RTrim(nextFUND) & " : " & Mid(nextTrx
8, 6) & " trades"
Range(Trx.Offset(3, -2), Trx.Offset(3, 1)).Select
Selection.ClearContents
Range(Trx.Offset(3, -3), Trx.Offset(3, 1)).Select
Selection.ClearFormats
With Selection
.Font.Size = 10
.Font.Underline = False
.WrapText = True
.Orientation = 0
.RowHeight = 30
.VerticalAlignment = xlBottom
.ShrinkToFit = False
.Borders(xlEdgeBottom).Weight = xlHairline
.MergeCells = True
End With
Set nextTrx = Trx.Offset(4, 0)
Set nextFUND = FUND.Offset(4, 0)
Set Anymore = Trx.Offset(5, 0)
If Not IsEmpty(Anymore) Then
ActiveWindow.SelectedSheets.HPageBreaks.Ad
Before:=nextTrx
End If
End If
End If
Set Trx = nextTrx
Set FUND = nextFUND
Loop
End Sub
However, I need help as in currently I wanted to set one conditio
whereby, when there's a condition that match the 'Fund*' condition,
will like to copy the name of the fund and paste it at the first empt
cell from the top of the worksheet.
thus the eventual print report will be pages of different fund name a
the said cell.
pls help thk