LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Copy Values to Below last Populated Cell Q

I am trying to copy values in Trade up Meals cells A9; B9; J18; K18; L18;
N18; O18 (and for every 12th Row below these values) to a sheet called
Ingredient Products starting on the row below the last populated cell.

I am using the following code but am getting very unreliable data, does the
code look ok?

Thanks

Sub TradeupCostToIngredients_Post()
Dim I As Long, j As Long, k As Long, l As Long
Dim rng As Range, cell As Range
With Worksheets("Trade Up Meals")
Set rng = Union(.Range("A9"), .Range("B9"), .Range("J18"), .Range("K18"),
..Range("L18"), .Range("N18"), .Range("O18"))

I = 0
j = 0
l = 0
For Each cell In rng
j = cell.Row
l = l + 1
k = Worksheets("Ingredient Products").Cells(Rows.Count,
l).End(xlUp).Row + 1
Do While Not IsEmpty(.Cells(j, cell.Column))
.Cells(j, cell.Column).Copy
Worksheets("Ingredient Products") _
.Cells(k, l).PasteSpecial xlValues
k = k + 1
j = j + 12
Loop
Next
End With

Sheets("Ingredient Products").Select

Columns("B:B").Select
Columns("B:B").EntireColumn.AutoFit

Columns("C:G").Select
Application.CutCopyMode = False
Selection.NumberFormat = "#,##0.00"
Range("A1").Select

Set rng = Range("A1:G1").Resize(Cells(Rows.Count, "A").End(xlUp).Row, 7)
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A1").Select

Sheets("Master").Select
Range("A1").Select

End Sub



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy to new cells if populated srbow Excel Discussion (Misc queries) 1 April 30th 09 06:25 PM
Copy values from a cell based on values of another cell Spence10169 Excel Discussion (Misc queries) 4 January 13th 09 10:01 AM
copy last populated cell (moving) to another cell robert morris Excel Discussion (Misc queries) 1 August 23rd 08 10:16 PM
First populated cell in row array/ Last populated cell in row arra Skyscan Excel Worksheet Functions 7 May 29th 08 05:20 PM
using IF function to copy, but leave populated cell alone [email protected] Excel Worksheet Functions 5 May 12th 06 10:39 PM


All times are GMT +1. The time now is 05:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"