retrobeast
New Member
- Joined
- Jan 17, 2011
- Messages
- 6
I posted the following problem in the URL below and got the answer I needed by the amazing AlphaFrog.
What I need now is to know how to make data with more lines then a page actually go to the next page?
What is happening currently is that instead of flowing to next page the data just gets hidden on at the bottom of the first page. If I make the font smaller on the excel data it shows up.
Thanks
http://www.mrexcel.com/forum/showthread.php?t=521919
Code:
Sub Consolidate2()
Dim LR As Long, i As Long, MyVal As String
Application.ScreenUpdating = False
ActiveSheet.Copy After:=Sheets(Sheets.Count)
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = LR To 2 Step -1
If Not IsEmpty(Cells(i, "F")) Then MyVal = Cells(i, "F").Value & " - Qty:" & Cells(i, "G")
If Cells(i, "A") = Cells(i - 1, "A") Then
Cells(i - 1, "G") = Cells(i - 1, "G") & "," & vbLf & MyVal
Rows(i).EntireRow.Delete (xlShiftUp)
Else
Cells(i, "F") = MyVal
End If
Next i
Columns("F").ColumnWidth = 100
Columns("F").AutoFit
Range("B:B, E:E, G:J").Delete
Range("B:B").NumberFormat = "mm/dd/yyyy"
Application.ScreenUpdating = True
End Sub
What I need now is to know how to make data with more lines then a page actually go to the next page?
What is happening currently is that instead of flowing to next page the data just gets hidden on at the bottom of the first page. If I make the font smaller on the excel data it shows up.
Thanks
http://www.mrexcel.com/forum/showthread.php?t=521919
Code:
Sub Consolidate2()
Dim LR As Long, i As Long, MyVal As String
Application.ScreenUpdating = False
ActiveSheet.Copy After:=Sheets(Sheets.Count)
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = LR To 2 Step -1
If Not IsEmpty(Cells(i, "F")) Then MyVal = Cells(i, "F").Value & " - Qty:" & Cells(i, "G")
If Cells(i, "A") = Cells(i - 1, "A") Then
Cells(i - 1, "G") = Cells(i - 1, "G") & "," & vbLf & MyVal
Rows(i).EntireRow.Delete (xlShiftUp)
Else
Cells(i, "F") = MyVal
End If
Next i
Columns("F").ColumnWidth = 100
Columns("F").AutoFit
Range("B:B, E:E, G:J").Delete
Range("B:B").NumberFormat = "mm/dd/yyyy"
Application.ScreenUpdating = True
End Sub