Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Excel VBA Newbie

Hello,
I am just learning excel VBA so all suggestions are greatly appreciated.

Goal...
User selects a range of cells from the active sheet (any range not "A1:E1"
as below).
The selected range is then pasted on the "Red" sheet in the next available
empty row (no A1 as below).

I have recorded the macro below with the hope of modifying it to accomplish
the above. I have stumped myself before getting out of the starting blocks.

Sub Macro2()

Range("A1:E1").Select
Selection.Copy
Sheets("Red").Select
Range("A1").Select
ActiveSheet.Paste
End Sub
--
Thank-you and all suggestions are appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Excel VBA Newbie

Try this code...

Public Sub CopyLine()
Dim wksFrom As Worksheet
Dim wksTo As Worksheet
Dim rngFrom As Range

Set wksFrom = ActiveSheet
Set rngFrom = wksFrom.Range("A1:E1")
Set wksTo = Sheets("Red")

rngFrom.Copy wksTo.Range("A65535").End(xlUp).Offset(1, 0)

End Sub

"Anauna" wrote:

Hello,
I am just learning excel VBA so all suggestions are greatly appreciated.

Goal...
User selects a range of cells from the active sheet (any range not "A1:E1"
as below).
The selected range is then pasted on the "Red" sheet in the next available
empty row (no A1 as below).

I have recorded the macro below with the hope of modifying it to accomplish
the above. I have stumped myself before getting out of the starting blocks.

Sub Macro2()

Range("A1:E1").Select
Selection.Copy
Sheets("Red").Select
Range("A1").Select
ActiveSheet.Paste
End Sub
--
Thank-you and all suggestions are appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Excel VBA Newbie

Try:

Sub Test()
Selection.Copy
Sheets("Red").Select
Range("A65536").End(xlUp).Offset(1,0).Select
ActiveSheet.Paste
End Sub

Regards

Trevor


"Anauna" wrote in message
...
Hello,
I am just learning excel VBA so all suggestions are greatly appreciated.

Goal...
User selects a range of cells from the active sheet (any range not "A1:E1"
as below).
The selected range is then pasted on the "Red" sheet in the next available
empty row (no A1 as below).

I have recorded the macro below with the hope of modifying it to
accomplish
the above. I have stumped myself before getting out of the starting
blocks.

Sub Macro2()

Range("A1:E1").Select
Selection.Copy
Sheets("Red").Select
Range("A1").Select
ActiveSheet.Paste
End Sub
--
Thank-you and all suggestions are appreciated.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Excel VBA Newbie

One way:

ActiveSheet.Range("A1:E1").Copy _
Destination:=Sheets("Red").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)



Note that selecting or activating is almost never necessary (though
that's what the macro recorder uses).

In article ,
Anauna wrote:

Hello,
I am just learning excel VBA so all suggestions are greatly appreciated.

Goal...
User selects a range of cells from the active sheet (any range not "A1:E1"
as below).
The selected range is then pasted on the "Red" sheet in the next available
empty row (no A1 as below).

I have recorded the macro below with the hope of modifying it to accomplish
the above. I have stumped myself before getting out of the starting blocks.

Sub Macro2()

Range("A1:E1").Select
Selection.Copy
Sheets("Red").Select
Range("A1").Select
ActiveSheet.Paste
End Sub

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
Real Newbie newbie question Dave New Users to Excel 0 January 10th 07 07:55 PM
help for an excel newbie gingertips Excel Worksheet Functions 2 January 30th 06 06:55 PM
Please help an Excel Newbie! Mustangman New Users to Excel 1 December 27th 05 03:15 AM
Newbie Excel User Needs Help! Piano_Man Excel Programming 2 April 15th 04 06:11 AM
Newbie help...VBA w/ Excel Joe Excel Programming 3 August 11th 03 11:30 PM


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