Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Adding Data to Next Available Line

I have written a macro that allows me to input a line of data on a sheet and hit a button and allow it to be added to the next open line on another sheet. This works fine, but I now need to be able to skip cells in between the ones I am adding, like add "A20:G20, M20:AB20" Here is what I am using right now to add this line of data

Private Sub CommandButton1_Click(

' Macro3 Macr
' Macro recorded 12/8/2003 by Brian McGuir

Sheets("input").Range("A20:M20,Q20:AG20").Copy Destination:=
Sheets("electrical").Cells(Rows.Count, 1).End(xlUp)
.Offset(1, 0
Worksheets("input").Range("A20:AG20").ClearContent
End Su

But as I have it written now, it replaces the entire data line, which I can't do anymore. Any input on how to get around this would be greatly appreciated. Thanks in advance

Brian
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Adding Data to Next Available Line

change
Worksheets("input").Range("A20:AG20").ClearContent s

to
Sheets("input").Range("A20:M20,Q20:AG20").ClearCon tents

?????

--
Regards,
Tom Ogilvy


"Brian McGuire" wrote in message
...
I have written a macro that allows me to input a line of data on a sheet

and hit a button and allow it to be added to the next open line on another
sheet. This works fine, but I now need to be able to skip cells in between
the ones I am adding, like add "A20:G20, M20:AB20" Here is what I am using
right now to add this line of data:

Private Sub CommandButton1_Click()
'
' Macro3 Macro
' Macro recorded 12/8/2003 by Brian McGuire

Sheets("input").Range("A20:M20,Q20:AG20").Copy Destination:= _
Sheets("electrical").Cells(Rows.Count, 1).End(xlUp) _
.Offset(1, 0)
Worksheets("input").Range("A20:AG20").ClearContent s
End Sub

But as I have it written now, it replaces the entire data line, which I

can't do anymore. Any input on how to get around this would be greatly
appreciated. Thanks in advance.

Brian



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Adding Data to Next Available Line

When I did that it shifted the data in the right cells 3 places over (the amount of cells I am attempting to skip). I think the problem comes in with the copy destination command

Sheets("input").Range("A20:M20,Q20:AG20").Copy Destination:= _
Sheets("electrical").Cells(Rows.Count, 1).End(xlUp) _
.Offset(1, 0)

By its nature I think it takes the last open space in the first column and fills in the data in order. If anyone knows anyway to modify this (I didn't write it so I am not sure how the commands work) I think that would probably solve my problem. Thanks.

Brian

----- Tom Ogilvy wrote: -----

change
Worksheets("input").Range("A20:AG20").ClearContent s

to
Sheets("input").Range("A20:M20,Q20:AG20").ClearCon tents

?????

--
Regards,
Tom Ogilvy


"Brian McGuire" wrote in message
...
I have written a macro that allows me to input a line of data on a sheet

and hit a button and allow it to be added to the next open line on another
sheet. This works fine, but I now need to be able to skip cells in between
the ones I am adding, like add "A20:G20, M20:AB20" Here is what I am using
right now to add this line of data:
Private Sub CommandButton1_Click()

'
' Macro3 Macro
' Macro recorded 12/8/2003 by Brian McGuire
Sheets("input").Range("A20:M20,Q20:AG20").Copy Destination:= _

Sheets("electrical").Cells(Rows.Count, 1).End(xlUp) _
.Offset(1, 0)
Worksheets("input").Range("A20:AG20").ClearContent s
End Sub
But as I have it written now, it replaces the entire data line, which I

can't do anymore. Any input on how to get around this would be greatly
appreciated. Thanks in advance.
Brian




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
Problem adding vertical marker line to line chart lbb Charts and Charting in Excel 6 January 9th 09 09:02 AM
adding a line to show average for a data series on a chart Judy Rose Charts and Charting in Excel 1 August 22nd 08 10:01 PM
Adding an Average line (from data sheet) to a chart automatically. Judi Charts and Charting in Excel 5 January 4th 07 01:31 PM
Moving data labels around with VBA (and adding a line between two Caro-Kann Defence Charts and Charting in Excel 4 November 30th 05 08:51 AM
What is meant by adding outline to data in excel single line style hijamie1 Excel Discussion (Misc queries) 0 September 24th 05 12:46 PM


All times are GMT +1. The time now is 10:35 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"