Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default MACRO HELP REQUIRED PLEASE!

Hi,

CAn anyone offer any MACRO advice? Ive recorded the folling MACRO which
has got me 90% the

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 31/03/2005 by Andrew Fletcher
'

'
Application.Goto Reference:="ahu1"
Selection.Copy
Sheets("Points List").Select
Range("A9").Select
ActiveSheet.Paste
Range("A25").Select
End Sub

This macro copies a group of cells, in this case with the range name
"ahu1" from a sheet known as 'clipboard' and pastes them to a sheet
known as 'points list'.

I need to be able to select where in the points list sheet the paste
occurs by selecting the active cell, which in the above example refers
to cell A9 every time I run the MACRO.

Thanks to previous contributions, due to my lack of VBA skills I
couldnt get the examples kindly proffered to work. THe above is all I
require to achieve however.

Regards,
Andy Fletcher.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default MACRO HELP REQUIRED PLEASE!

Hi, Andy,

Why don't you just have your macro performing the copy and switch to
PointsList sheet?
Then, you could just click the cell you want and do [Control]-V or click the
Paste tool to paste your data in?
You have to click your target cell anyway, so one more click shouldn't make
much difference. Also, as your VBA improves, you'll see that you don't need
to GOTO a range in order to copy it (see below)

Sub Macro1()
Worksheets("Clipboard").Range("ahu1").copy
Sheets("Points List").activate
End Sub

Hope this helps

Pete



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default MACRO HELP REQUIRED PLEASE!

Sub Macro1()
Dim rng As Range

Set rng = Application.InputBox("Select position to paste to", Type:=8)
Worksheets("Clipboard").Range("ahu1").Copy Destination:=rng
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Fletch" wrote in message
oups.com...
Hi,

CAn anyone offer any MACRO advice? Ive recorded the folling MACRO which
has got me 90% the

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 31/03/2005 by Andrew Fletcher
'

'
Application.Goto Reference:="ahu1"
Selection.Copy
Sheets("Points List").Select
Range("A9").Select
ActiveSheet.Paste
Range("A25").Select
End Sub

This macro copies a group of cells, in this case with the range name
"ahu1" from a sheet known as 'clipboard' and pastes them to a sheet
known as 'points list'.

I need to be able to select where in the points list sheet the paste
occurs by selecting the active cell, which in the above example refers
to cell A9 every time I run the MACRO.

Thanks to previous contributions, due to my lack of VBA skills I
couldnt get the examples kindly proffered to work. THe above is all I
require to achieve however.

Regards,
Andy Fletcher.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default MACRO HELP REQUIRED PLEASE!

Thanks fellas, I have cracked it with this:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 31/03/2005 by Andrew Fletcher
'
Application.Goto Reference:="ahu1"
Selection.Copy
Sheets("Points List").Select
ActiveSheet.Paste
End Sub

For all the other plant groups I have just copied and pasted modules,
substituting the range name along the way.

Remarkably, the solution was to just remove the "range" commands. It
was staring me in the face I just couldnt see it. I have added all the
plant items to a drop down list - its very slick.

Thanks again, I will get the hang of this VB if it kills me. What
originally looked like klingon now bears some resemblance to French, ie
some comprehension is evident...

Andy.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default MACRO HELP REQUIRED PLEASE!

Some supplemental information:
Since your new to vba, it might be useful to point out that if the user
clicks cancel in the input box you will get an error. You can correct this
with

Sub Macro1()
Dim rng As Range
On Error Resume Next
Set rng = Application.InputBox("Select position to paste to", Type:=8)
Worksheets("Clipboard").Range("ahu1").Copy Destination:=rng
End Sub

again, since you are new, this could be interpreted to suggest that you
should put On Error Resume Next at the top of every procedure, but that
would be a really bad idea. A better example although in this case
unnecessary would be to do:

Sub Macro1()
Dim rng As Range
On Error Resume Next
Set rng = Application.InputBox("Select position to paste to", Type:=8)
On Error goto 0
if not rng is nothing then
Worksheets("Clipboard").Range("ahu1").Copy Destination:=rng
End if
End Sub


This limits the amount of time in which On Error Resume Next is in effect
and which is highly desirable, as otherwise it could mask real errors that
need to be corrected.

--
Regards,
Tom Ogilvy



"Bob Phillips" wrote in message
...
Sub Macro1()
Dim rng As Range

Set rng = Application.InputBox("Select position to paste to", Type:=8)
Worksheets("Clipboard").Range("ahu1").Copy Destination:=rng
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Fletch" wrote in message
oups.com...
Hi,

CAn anyone offer any MACRO advice? Ive recorded the folling MACRO which
has got me 90% the

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 31/03/2005 by Andrew Fletcher
'

'
Application.Goto Reference:="ahu1"
Selection.Copy
Sheets("Points List").Select
Range("A9").Select
ActiveSheet.Paste
Range("A25").Select
End Sub

This macro copies a group of cells, in this case with the range name
"ahu1" from a sheet known as 'clipboard' and pastes them to a sheet
known as 'points list'.

I need to be able to select where in the points list sheet the paste
occurs by selecting the active cell, which in the above example refers
to cell A9 every time I run the MACRO.

Thanks to previous contributions, due to my lack of VBA skills I
couldnt get the examples kindly proffered to work. THe above is all I
require to achieve however.

Regards,
Andy Fletcher.





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 required please Dr Hackenbush Excel Discussion (Misc queries) 4 February 10th 10 09:29 AM
Macro Help Required Dan Wood Excel Discussion (Misc queries) 3 January 5th 10 05:49 PM
Macro required PCOR Excel Worksheet Functions 3 December 11th 05 07:36 PM
vba macro required ? Peter O'Leary Links and Linking in Excel 1 April 14th 05 11:49 PM
Macro help required! Don Niall Excel Programming 7 June 24th 04 07:12 PM


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