PC Review


Reply
Thread Tools Rate Thread

automated copy and past special feature

 
 
=?Utf-8?B?Q2hldnk=?=
Guest
Posts: n/a
 
      29th Oct 2007
I am looking to copy and paste values using a macro. I am able the create
this macro but run into a problem when I need to click the macro button for
the next row. For example it will run for row3 but when i go to row4 it wont
run. I need the macro to run on the active row? Can anyone please help.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?U2VhbkMgVUs=?=
Guest
Posts: n/a
 
      29th Oct 2007
Hi Chevy,

Can you give your code please, it is much easier for people to see any
problems in your code that way.

Cheers,

Sean.
--
(please remember to click yes if replies you receive are helpful to you)


"Chevy" wrote:

> I am looking to copy and paste values using a macro. I am able the create
> this macro but run into a problem when I need to click the macro button for
> the next row. For example it will run for row3 but when i go to row4 it wont
> run. I need the macro to run on the active row? Can anyone please help.

 
Reply With Quote
 
=?Utf-8?B?Q2hldnk=?=
Guest
Posts: n/a
 
      29th Oct 2007
Here it is. Thank you so much for looking into this for me.

Sub finish()
'
' finish Macro
' Macro recorded 10/29/2007 by chevalia
'

'
Range("A10:Q10").Select
Selection.Copy
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

"SeanC UK" wrote:

> Hi Chevy,
>
> Can you give your code please, it is much easier for people to see any
> problems in your code that way.
>
> Cheers,
>
> Sean.
> --
> (please remember to click yes if replies you receive are helpful to you)
>
>
> "Chevy" wrote:
>
> > I am looking to copy and paste values using a macro. I am able the create
> > this macro but run into a problem when I need to click the macro button for
> > the next row. For example it will run for row3 but when i go to row4 it wont
> > run. I need the macro to run on the active row? Can anyone please help.

 
Reply With Quote
 
=?Utf-8?B?U2VhbkMgVUs=?=
Guest
Posts: n/a
 
      29th Oct 2007
Hi Chevy,

From your code I am assuming that there are formulae in the cells A10 to
Q10, and you are copying them and using Paste Special to paste the values in
place of each formula. I have written something that will do this for the
active row, from A (1) to Q (17). In other words, it will paste the values of
those 17 columns in the active row over themselves. If you were trying to
paste a specific row into the active row, or paste the active row into a
specific row, then let me know and I will rewrite the code for that
particular case.

Public Sub Finish()
Dim lngActiveRow As Long
lngActiveRow = ActiveCell.Row
Range(Cells(lngActiveRow, 1), Cells(lngActiveRow, 17)).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
End Sub

I hope this helps,

Sean.




--
(please remember to click yes if replies you receive are helpful to you)


"Chevy" wrote:

> Here it is. Thank you so much for looking into this for me.
>
> Sub finish()
> '
> ' finish Macro
> ' Macro recorded 10/29/2007 by chevalia
> '
>
> '
> Range("A10:Q10").Select
> Selection.Copy
> ActiveWindow.ScrollColumn = 2
> ActiveWindow.ScrollColumn = 1
> Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> SkipBlanks _
> :=False, Transpose:=False
> End Sub
>
> "SeanC UK" wrote:
>
> > Hi Chevy,
> >
> > Can you give your code please, it is much easier for people to see any
> > problems in your code that way.
> >
> > Cheers,
> >
> > Sean.
> > --
> > (please remember to click yes if replies you receive are helpful to you)
> >
> >
> > "Chevy" wrote:
> >
> > > I am looking to copy and paste values using a macro. I am able the create
> > > this macro but run into a problem when I need to click the macro button for
> > > the next row. For example it will run for row3 but when i go to row4 it wont
> > > run. I need the macro to run on the active row? Can anyone please help.

 
Reply With Quote
 
=?Utf-8?B?Q2hldnk=?=
Guest
Posts: n/a
 
      29th Oct 2007
SEAN C,

OH MY GOODNESS. You are a genious. Hey, how can I become more efficient
with macros? Is there a class that microsoft offers? Thanks again. This
message board rocks. I love it.



"SeanC UK" wrote:

> Hi Chevy,
>
> From your code I am assuming that there are formulae in the cells A10 to
> Q10, and you are copying them and using Paste Special to paste the values in
> place of each formula. I have written something that will do this for the
> active row, from A (1) to Q (17). In other words, it will paste the values of
> those 17 columns in the active row over themselves. If you were trying to
> paste a specific row into the active row, or paste the active row into a
> specific row, then let me know and I will rewrite the code for that
> particular case.
>
> Public Sub Finish()
> Dim lngActiveRow As Long
> lngActiveRow = ActiveCell.Row
> Range(Cells(lngActiveRow, 1), Cells(lngActiveRow, 17)).Select
> Selection.Copy
> Selection.PasteSpecial Paste:=xlPasteValues, _
> Operation:=xlNone, _
> SkipBlanks:=False, _
> Transpose:=False
> End Sub
>
> I hope this helps,
>
> Sean.
>
>
>
>
> --
> (please remember to click yes if replies you receive are helpful to you)
>
>
> "Chevy" wrote:
>
> > Here it is. Thank you so much for looking into this for me.
> >
> > Sub finish()
> > '
> > ' finish Macro
> > ' Macro recorded 10/29/2007 by chevalia
> > '
> >
> > '
> > Range("A10:Q10").Select
> > Selection.Copy
> > ActiveWindow.ScrollColumn = 2
> > ActiveWindow.ScrollColumn = 1
> > Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> > SkipBlanks _
> > :=False, Transpose:=False
> > End Sub
> >
> > "SeanC UK" wrote:
> >
> > > Hi Chevy,
> > >
> > > Can you give your code please, it is much easier for people to see any
> > > problems in your code that way.
> > >
> > > Cheers,
> > >
> > > Sean.
> > > --
> > > (please remember to click yes if replies you receive are helpful to you)
> > >
> > >
> > > "Chevy" wrote:
> > >
> > > > I am looking to copy and paste values using a macro. I am able the create
> > > > this macro but run into a problem when I need to click the macro button for
> > > > the next row. For example it will run for row3 but when i go to row4 it wont
> > > > run. I need the macro to run on the active row? Can anyone please help.

 
Reply With Quote
 
=?Utf-8?B?U2VhbkMgVUs=?=
Guest
Posts: n/a
 
      30th Oct 2007
Hi Chevy,

I'm glad it helped.

I'm not sure if there are classes in VBA. I'd just play around with it, and
use the Help files as they give you a lot of information on objects, methods,
properties, functions etc. Record macros to get a flavour of what it is you
are trying to achieve, and then play with the code you just recorded it make
it more specific, or more flexible etc. There are plenty of books available
too, but I'd just start by playing around (well, actually I did!)

Also, just read the posts in here, basic computer programming techniques
will get you results, but there are many shortcuts specific to Excel that can
save a lot of processing time.

I'm sure we're all learning new stuff in here, and when we're not, they
simply create a newer version!

Cheers,

Sean.
--
(please remember to click yes if replies you receive are helpful to you)


"Chevy" wrote:

> SEAN C,
>
> OH MY GOODNESS. You are a genious. Hey, how can I become more efficient
> with macros? Is there a class that microsoft offers? Thanks again. This
> message board rocks. I love it.
>
>
>
> "SeanC UK" wrote:
>
> > Hi Chevy,
> >
> > From your code I am assuming that there are formulae in the cells A10 to
> > Q10, and you are copying them and using Paste Special to paste the values in
> > place of each formula. I have written something that will do this for the
> > active row, from A (1) to Q (17). In other words, it will paste the values of
> > those 17 columns in the active row over themselves. If you were trying to
> > paste a specific row into the active row, or paste the active row into a
> > specific row, then let me know and I will rewrite the code for that
> > particular case.
> >
> > Public Sub Finish()
> > Dim lngActiveRow As Long
> > lngActiveRow = ActiveCell.Row
> > Range(Cells(lngActiveRow, 1), Cells(lngActiveRow, 17)).Select
> > Selection.Copy
> > Selection.PasteSpecial Paste:=xlPasteValues, _
> > Operation:=xlNone, _
> > SkipBlanks:=False, _
> > Transpose:=False
> > End Sub
> >
> > I hope this helps,
> >
> > Sean.
> >
> >
> >
> >
> > --
> > (please remember to click yes if replies you receive are helpful to you)
> >
> >
> > "Chevy" wrote:
> >
> > > Here it is. Thank you so much for looking into this for me.
> > >
> > > Sub finish()
> > > '
> > > ' finish Macro
> > > ' Macro recorded 10/29/2007 by chevalia
> > > '
> > >
> > > '
> > > Range("A10:Q10").Select
> > > Selection.Copy
> > > ActiveWindow.ScrollColumn = 2
> > > ActiveWindow.ScrollColumn = 1
> > > Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> > > SkipBlanks _
> > > :=False, Transpose:=False
> > > End Sub
> > >
> > > "SeanC UK" wrote:
> > >
> > > > Hi Chevy,
> > > >
> > > > Can you give your code please, it is much easier for people to see any
> > > > problems in your code that way.
> > > >
> > > > Cheers,
> > > >
> > > > Sean.
> > > > --
> > > > (please remember to click yes if replies you receive are helpful to you)
> > > >
> > > >
> > > > "Chevy" wrote:
> > > >
> > > > > I am looking to copy and paste values using a macro. I am able the create
> > > > > this macro but run into a problem when I need to click the macro button for
> > > > > the next row. For example it will run for row3 but when i go to row4 it wont
> > > > > run. I need the macro to run on the active row? Can anyone please help.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code to replace Past Special Howard Microsoft Excel Programming 4 29th Oct 2009 02:48 PM
past special geb Microsoft Excel Worksheet Functions 1 1st Jun 2009 10:49 PM
wath is defferent between past and past special help plz ?? =?Utf-8?B?TS4gQXJlZiBraGF5YmFy?= Microsoft Word Document Management 1 29th May 2006 09:21 AM
past special - csv format warner2525@aol.com Microsoft Excel Worksheet Functions 0 24th Sep 2004 10:57 PM
Cut & Past Special picktr Microsoft Excel Misc 3 1st May 2004 10:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:24 AM.