Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
RJJ RJJ is offline
external usenet poster
 
Posts: 26
Default copy cell with macro and increment down each time

I need to create a macro that copies two adjacent cells A148 & B148 (same
cells each time but with a different value each time) and pastes them into
another column but moving down one row each time. The object is to retain the
previous values ultimately resulting in a column of various data values. I am
able to copy and paste with a macro but when run, it overwrites the previous
value because the paste was assigned to a particular cell. Or, is it somehow
possible to store the first set of values elsewhere before overwriting?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default copy cell with macro and increment down each time

Will will use column Y & Z:

Sub rjj()
Set r = Range("A148:B148")
n = Cells(Rows.Count, "Y").End(xlUp).Row + 1
r.Copy Cells(n, "Y")
End Sub
--
Gary''s Student - gsnu200785


"RJJ" wrote:

I need to create a macro that copies two adjacent cells A148 & B148 (same
cells each time but with a different value each time) and pastes them into
another column but moving down one row each time. The object is to retain the
previous values ultimately resulting in a column of various data values. I am
able to copy and paste with a macro but when run, it overwrites the previous
value because the paste was assigned to a particular cell. Or, is it somehow
possible to store the first set of values elsewhere before overwriting?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
RJJ RJJ is offline
external usenet poster
 
Posts: 26
Default copy cell with macro and increment down each time

I'm sorry but I don't quite understand. Should I edit my existing "copy
macro"? This is what I have now that copies to the same cell each time. The
reason it is a "Paste Special" is because I am excluding the formula in the
cell I am copying from.


Sub SaveCells()
'
' SaveCells Macro
'

'
Range("A148:B148").Select
Selection.Copy
Range("E148:F148").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
End Sub

"Gary''s Student" wrote:

Will will use column Y & Z:

Sub rjj()
Set r = Range("A148:B148")
n = Cells(Rows.Count, "Y").End(xlUp).Row + 1
r.Copy Cells(n, "Y")
End Sub
--
Gary''s Student - gsnu200785


"RJJ" wrote:

I need to create a macro that copies two adjacent cells A148 & B148 (same
cells each time but with a different value each time) and pastes them into
another column but moving down one row each time. The object is to retain the
previous values ultimately resulting in a column of various data values. I am
able to copy and paste with a macro but when run, it overwrites the previous
value because the paste was assigned to a particular cell. Or, is it somehow
possible to store the first set of values elsewhere before overwriting?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default copy cell with macro and increment down each time

No, continue using your macro.

Just replace the single line:

Range("E148:F148").Select

with

n = Cells(Rows.Count, "E").End(xlUp).Row + 1
Range("E" & n & ":F" & n).Select


--
Gary''s Student - gsnu200785


"RJJ" wrote:

I'm sorry but I don't quite understand. Should I edit my existing "copy
macro"? This is what I have now that copies to the same cell each time. The
reason it is a "Paste Special" is because I am excluding the formula in the
cell I am copying from.


Sub SaveCells()
'
' SaveCells Macro
'

'
Range("A148:B148").Select
Selection.Copy
Range("E148:F148").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
End Sub

"Gary''s Student" wrote:

Will will use column Y & Z:

Sub rjj()
Set r = Range("A148:B148")
n = Cells(Rows.Count, "Y").End(xlUp).Row + 1
r.Copy Cells(n, "Y")
End Sub
--
Gary''s Student - gsnu200785


"RJJ" wrote:

I need to create a macro that copies two adjacent cells A148 & B148 (same
cells each time but with a different value each time) and pastes them into
another column but moving down one row each time. The object is to retain the
previous values ultimately resulting in a column of various data values. I am
able to copy and paste with a macro but when run, it overwrites the previous
value because the paste was assigned to a particular cell. Or, is it somehow
possible to store the first set of values elsewhere before overwriting?

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
RJJ RJJ is offline
external usenet poster
 
Posts: 26
Default copy cell with macro and increment down each time

Thank You, works great but now:

It only works with the macro button on the original worksheet. I assigned
the macro to a new button on sheet "PO-LLC". but it does not fill the cells
in sheet "P.O.# Usage" The original sheet is "P.O. # Usage". My now working
macro (only on original sheet) is:

Range("A1:B1").Select
Selection.Copy
n = Cells(Rows.Count, "A").End(xlUp).Row + 1
Range("A" & n & ":B" & n).Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
ActiveWorkbook.Save
End Sub

I've noticed that when I activate the macro button that resides on the
PO-LLC sheet, it tries to populate cells A2 and B2 on that sheet although
nothing appears in them. They only highlight when I activate the macro
button. I hope that makes sense. I can't tell you how much I appreciate your
help with this.

"Gary''s Student" wrote:

No, continue using your macro.

Just replace the single line:

Range("E148:F148").Select

with

n = Cells(Rows.Count, "E").End(xlUp).Row + 1
Range("E" & n & ":F" & n).Select


--
Gary''s Student - gsnu200785


"RJJ" wrote:

I'm sorry but I don't quite understand. Should I edit my existing "copy
macro"? This is what I have now that copies to the same cell each time. The
reason it is a "Paste Special" is because I am excluding the formula in the
cell I am copying from.


Sub SaveCells()
'
' SaveCells Macro
'

'
Range("A148:B148").Select
Selection.Copy
Range("E148:F148").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
End Sub

"Gary''s Student" wrote:

Will will use column Y & Z:

Sub rjj()
Set r = Range("A148:B148")
n = Cells(Rows.Count, "Y").End(xlUp).Row + 1
r.Copy Cells(n, "Y")
End Sub
--
Gary''s Student - gsnu200785


"RJJ" wrote:

I need to create a macro that copies two adjacent cells A148 & B148 (same
cells each time but with a different value each time) and pastes them into
another column but moving down one row each time. The object is to retain the
previous values ultimately resulting in a column of various data values. I am
able to copy and paste with a macro but when run, it overwrites the previous
value because the paste was assigned to a particular cell. Or, is it somehow
possible to store the first set of values elsewhere before overwriting?



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default copy cell with macro and increment down each time

I am glad we are making progress. I don't know how your buttons are setup,
but let's say we have ten sheets with a button on each sheet. Create a
single macro in a module (bring up VBA and Insert Module). Then you can
connect each button with the same macro. When the macro runs, it should run
on the active sheet.
--
Gary''s Student - gsnu200785


"RJJ" wrote:

Thank You, works great but now:

It only works with the macro button on the original worksheet. I assigned
the macro to a new button on sheet "PO-LLC". but it does not fill the cells
in sheet "P.O.# Usage" The original sheet is "P.O. # Usage". My now working
macro (only on original sheet) is:

Range("A1:B1").Select
Selection.Copy
n = Cells(Rows.Count, "A").End(xlUp).Row + 1
Range("A" & n & ":B" & n).Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
ActiveWorkbook.Save
End Sub

I've noticed that when I activate the macro button that resides on the
PO-LLC sheet, it tries to populate cells A2 and B2 on that sheet although
nothing appears in them. They only highlight when I activate the macro
button. I hope that makes sense. I can't tell you how much I appreciate your
help with this.

"Gary''s Student" wrote:

No, continue using your macro.

Just replace the single line:

Range("E148:F148").Select

with

n = Cells(Rows.Count, "E").End(xlUp).Row + 1
Range("E" & n & ":F" & n).Select


--
Gary''s Student - gsnu200785


"RJJ" wrote:

I'm sorry but I don't quite understand. Should I edit my existing "copy
macro"? This is what I have now that copies to the same cell each time. The
reason it is a "Paste Special" is because I am excluding the formula in the
cell I am copying from.


Sub SaveCells()
'
' SaveCells Macro
'

'
Range("A148:B148").Select
Selection.Copy
Range("E148:F148").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
End Sub

"Gary''s Student" wrote:

Will will use column Y & Z:

Sub rjj()
Set r = Range("A148:B148")
n = Cells(Rows.Count, "Y").End(xlUp).Row + 1
r.Copy Cells(n, "Y")
End Sub
--
Gary''s Student - gsnu200785


"RJJ" wrote:

I need to create a macro that copies two adjacent cells A148 & B148 (same
cells each time but with a different value each time) and pastes them into
another column but moving down one row each time. The object is to retain the
previous values ultimately resulting in a column of various data values. I am
able to copy and paste with a macro but when run, it overwrites the previous
value because the paste was assigned to a particular cell. Or, is it somehow
possible to store the first set of values elsewhere before overwriting?

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
RJJ RJJ is offline
external usenet poster
 
Posts: 26
Default copy cell with macro and increment down each time

I can "bring up VBA and Insert Module, but then what? Now, when I set up a
macro, I record it with my mouse clicks and then stop recording. That said,
I'm not sure what to do when I open a new module via VBA. As far as buttons
on my sheet, I really only need one button on sheet PO-LLC to copy, paste,
increment, and store values on sheet PO # Usage.

"Gary''s Student" wrote:

I am glad we are making progress. I don't know how your buttons are setup,
but let's say we have ten sheets with a button on each sheet. Create a
single macro in a module (bring up VBA and Insert Module). Then you can
connect each button with the same macro. When the macro runs, it should run
on the active sheet.
--
Gary''s Student - gsnu200785


"RJJ" wrote:

Thank You, works great but now:

It only works with the macro button on the original worksheet. I assigned
the macro to a new button on sheet "PO-LLC". but it does not fill the cells
in sheet "P.O.# Usage" The original sheet is "P.O. # Usage". My now working
macro (only on original sheet) is:

Range("A1:B1").Select
Selection.Copy
n = Cells(Rows.Count, "A").End(xlUp).Row + 1
Range("A" & n & ":B" & n).Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
ActiveWorkbook.Save
End Sub

I've noticed that when I activate the macro button that resides on the
PO-LLC sheet, it tries to populate cells A2 and B2 on that sheet although
nothing appears in them. They only highlight when I activate the macro
button. I hope that makes sense. I can't tell you how much I appreciate your
help with this.

"Gary''s Student" wrote:

No, continue using your macro.

Just replace the single line:

Range("E148:F148").Select

with

n = Cells(Rows.Count, "E").End(xlUp).Row + 1
Range("E" & n & ":F" & n).Select


--
Gary''s Student - gsnu200785


"RJJ" wrote:

I'm sorry but I don't quite understand. Should I edit my existing "copy
macro"? This is what I have now that copies to the same cell each time. The
reason it is a "Paste Special" is because I am excluding the formula in the
cell I am copying from.


Sub SaveCells()
'
' SaveCells Macro
'

'
Range("A148:B148").Select
Selection.Copy
Range("E148:F148").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
End Sub

"Gary''s Student" wrote:

Will will use column Y & Z:

Sub rjj()
Set r = Range("A148:B148")
n = Cells(Rows.Count, "Y").End(xlUp).Row + 1
r.Copy Cells(n, "Y")
End Sub
--
Gary''s Student - gsnu200785


"RJJ" wrote:

I need to create a macro that copies two adjacent cells A148 & B148 (same
cells each time but with a different value each time) and pastes them into
another column but moving down one row each time. The object is to retain the
previous values ultimately resulting in a column of various data values. I am
able to copy and paste with a macro but when run, it overwrites the previous
value because the paste was assigned to a particular cell. Or, is it somehow
possible to store the first set of values elsewhere before overwriting?

Reply
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
Macro - How to increment cell reference by one row lau_ash[_2_] Excel Worksheet Functions 7 April 4th 23 02:17 PM
how to increment time & subtract time? Crackles McFarly Excel Worksheet Functions 9 November 1st 07 10:10 PM
Increment formula for time Ltat42a Excel Discussion (Misc queries) 4 August 2nd 06 11:21 PM
copy increment by 1 [email protected] Excel Discussion (Misc queries) 7 March 22nd 06 04:46 PM
Time and Date increment La La Lara Excel Discussion (Misc queries) 0 January 18th 05 09:59 AM


All times are GMT +1. The time now is 05:13 PM.

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"