Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, I need a piece of code that copies a range, ie B10:K100 plus. This range
would vary in size depending on the amount of data. I then need this data to be copied and pasted values onto a different tab (Database) and inserted below the previous data. I can do most of the code apart from where it looks for the previous data and drops it below the last occupied cells. Below is my poor attempt Sub Macro2() Application.ScreenUpdating = False Dim iRow As Long Application.Goto Reference:="Data" Selection.Copy Sheets("Database").Select iFreeRow = Cells(Rows.Count, "B").End(xlUp) Selection.PasteSpecial Paste:=xlPasteValues Sheets("Input").Select Range("B6").Select End Sub Any help, greatly appreciated Regards John |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It appears you're upper left cell in the destination range will be in Column
B (correct?). Your code to find the last non-empty cell in column B appears OK except you left "Row" off the end. You did not specify what property to return, so it defaulted to returning the cells value. Also, you need to specify what range to paste the data into. Selection will refer to whatever range happens to be selected. iFreeRow = Cells(Rows.Count, "B").End(xlUp).Row Cells(iFreeRow+1,"B").PasteSpecial Paste:=xlPasteValues Application.CutCopyMode = False "JohnUK" wrote: Hi, I need a piece of code that copies a range, ie B10:K100 plus. This range would vary in size depending on the amount of data. I then need this data to be copied and pasted values onto a different tab (Database) and inserted below the previous data. I can do most of the code apart from where it looks for the previous data and drops it below the last occupied cells. Below is my poor attempt Sub Macro2() Application.ScreenUpdating = False Dim iRow As Long Application.Goto Reference:="Data" Selection.Copy Sheets("Database").Select iFreeRow = Cells(Rows.Count, "B").End(xlUp) Selection.PasteSpecial Paste:=xlPasteValues Sheets("Input").Select Range("B6").Select End Sub Any help, greatly appreciated Regards John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
simple loop needed please | Excel Discussion (Misc queries) | |||
Loop for VBA code? | Excel Worksheet Functions | |||
How to get my code to loop | Excel Programming | |||
Urgent Help needed on! Copy and Paste a Formula as Values using a Loop statement | Excel Programming | |||
help needed with timer / loop | Excel Programming |