Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default VB Code For Macro

I need to build a macro that will copy from whatever cell I have highlited
and paste to a specific other cell. The idea is that I have entered a control
button and when pressed the macro is run. Unfortunately I know nothing about
building it on VB. Could someone give me the code to copy and paste into
visual basic. I need to do this on multiple buttons so I realise I will have
to change the destination part of the code. Could you show me where I change
this.

Thanks in advance
--
Barnie Gumble Esq
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default VB Code For Macro

Hi Barnie

You have to modyfye this macro so it fits for you.


Sub Makro1()


Selection.Copy _
Destination:=Sheets("Your sheets name").Range("B1")




End Sub

Regards
Yngve

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default VB Code For Macro

Hi,

The best way for you to learn something like this (the same as for everyone
- myself included) is to use the Macro recorder on the Tools...Macros menu

This is always the best way to start when you don't know what objects you
need...

When you have finished recording the actions that you need the code for,
click Stop on the Tools..Macros menu, and use ALT-F8 to show the Macros
dialog.

Select the new macro that you just recorded, and choose 'Edit'

then you can see the code that has been recorded, and this will help you see
what objects are used, and give you a head start.

If you are still stuck modifying the code, let uis know and we'll help ...

HTH

Philip

"Barnie" wrote:

I need to build a macro that will copy from whatever cell I have highlited
and paste to a specific other cell. The idea is that I have entered a control
button and when pressed the macro is run. Unfortunately I know nothing about
building it on VB. Could someone give me the code to copy and paste into
visual basic. I need to do this on multiple buttons so I realise I will have
to change the destination part of the code. Could you show me where I change
this.

Thanks in advance
--
Barnie Gumble Esq

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default VB Code For Macro

I have done that and have got my code. The problem I am now experiencing is
that when I press the button it does not allow me to paste to the specific
cell I need. For example I need to be able to copy from any of columns D to I
and paste only to column L and only for the same row I am copying on.

Here is the code I have:
Range("D1").Select
Selection.Copy
Range("L1").Select
ActiveSheet.Paste

Would it be a case of just changing the range to ("D1,E1,F1,H1,I1,J1")?

Thanks
--
Barnie Gumble Esq


"Philip" wrote:

Hi,

The best way for you to learn something like this (the same as for everyone
- myself included) is to use the Macro recorder on the Tools...Macros menu

This is always the best way to start when you don't know what objects you
need...

When you have finished recording the actions that you need the code for,
click Stop on the Tools..Macros menu, and use ALT-F8 to show the Macros
dialog.

Select the new macro that you just recorded, and choose 'Edit'

then you can see the code that has been recorded, and this will help you see
what objects are used, and give you a head start.

If you are still stuck modifying the code, let uis know and we'll help ...

HTH

Philip

"Barnie" wrote:

I need to build a macro that will copy from whatever cell I have highlited
and paste to a specific other cell. The idea is that I have entered a control
button and when pressed the macro is run. Unfortunately I know nothing about
building it on VB. Could someone give me the code to copy and paste into
visual basic. I need to do this on multiple buttons so I realise I will have
to change the destination part of the code. Could you show me where I change
this.

Thanks in advance
--
Barnie Gumble Esq

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default VB Code For Macro

Hi Barnie
record, highlited Range("D1:j1") , copy it and paste it to anoder cell
and you will see.
Regards
Yngve



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default VB Code For Macro

Hey thanks. It's all finally seeming to work.
--
Barnie Gumble Esq


"evgny" wrote:

Hi Barnie

You have to modyfye this macro so it fits for you.


Sub Makro1()


Selection.Copy _
Destination:=Sheets("Your sheets name").Range("B1")




End Sub

Regards
Yngve


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
Deleting code from a macro (by a macro) Brettjg Excel Discussion (Misc queries) 2 May 8th 07 10:14 PM
read macro code by vb code Francesco Geri Excel Programming 2 October 7th 05 10:24 AM
do anybody have a sample code for executing excel macro from vb code?<eom B Deepak Excel Programming 2 September 30th 05 09:59 AM
Macro copying macro code TNSKHelp Excel Programming 1 June 17th 05 04:59 PM
Macro to change Macro code? Kaisies Excel Programming 2 March 23rd 05 03:34 AM


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