ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find first blank cell to paste into (https://www.excelbanter.com/excel-programming/355427-find-first-blank-cell-paste-into.html)

cereldine

Find first blank cell to paste into
 

HI, in the grand scheme of things i'm trying to write a macro to look a
a named range in one worksheet and copy into a current worksheet, i the
want to copy another named range and paste it in the cell immediatl
after the end of the first range of copied data, this data is then use
to generate a pivot table.

My code looks like the following

Application.Goto Reference:="IO_C"
Selection.Copy
Sheets("consolidate_raw_data").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False

'' end of initial paste Application.Got
Reference:="stat_consol"
Application.CutCopyMode = False
Selection.Copy
Sheets("consolidate_raw_data").Select
Range("A1").Select


''need code to find first empty cell, currently this code is no
dynamic and is looking at static cell values to paste within
Range("A1:E8352").Select
ActiveWindow.SmallScroll Down:=12
Range("A8352").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Rows("8352:8352").Select Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Selection.End(xlUp).Select

The code in red is what is calling the problems as it is an absolut
reference that was stored when i created my first macro. It is m
understanding that a line of code should be in place that dynamicall
finds the end of the first pasted range, selects the cell immediatl
beneath it and then pastes the data within it? Ive tried investigatin
.end but to avail.

Am i going along the right tracks? this is my first attempt at codin
in excel as most of my experience has come from Access

--
cereldin
-----------------------------------------------------------------------
cereldine's Profile: http://www.excelforum.com/member.php...fo&userid=3206
View this thread: http://www.excelforum.com/showthread.php?threadid=52009


Tom Ogilvy

Find first blank cell to paste into
 
Range("IO_C").Copy
Worksheets("consolidate_raw_data") _
.Range("A1").PasteSpecial xlValues
Range("stat_consol").copy
Worksheets("consolidate_raw_data") _
.cells(rows.count,1).End(xlup)(2) _
.PasteSpecial xlValues

--
Regards,
Tom Ogilvy


"cereldine" wrote
in message ...

HI, in the grand scheme of things i'm trying to write a macro to look at
a named range in one worksheet and copy into a current worksheet, i then
want to copy another named range and paste it in the cell immediatly
after the end of the first range of copied data, this data is then used
to generate a pivot table.

My code looks like the following

Application.Goto Reference:="IO_C"
Selection.Copy
Sheets("consolidate_raw_data").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False

'' end of initial paste Application.Goto
Reference:="stat_consol"
Application.CutCopyMode = False
Selection.Copy
Sheets("consolidate_raw_data").Select
Range("A1").Select


''need code to find first empty cell, currently this code is not
dynamic and is looking at static cell values to paste within
Range("A1:E8352").Select
ActiveWindow.SmallScroll Down:=12
Range("A8352").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Rows("8352:8352").Select Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Selection.End(xlUp).Select

The code in red is what is calling the problems as it is an absolute
reference that was stored when i created my first macro. It is my
understanding that a line of code should be in place that dynamically
finds the end of the first pasted range, selects the cell immediatly
beneath it and then pastes the data within it? Ive tried investigating
end but to avail.

Am i going along the right tracks? this is my first attempt at coding
in excel as most of my experience has come from Access.


--
cereldine
------------------------------------------------------------------------
cereldine's Profile:

http://www.excelforum.com/member.php...o&userid=32069
View this thread: http://www.excelforum.com/showthread...hreadid=520094





All times are GMT +1. The time now is 06:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com