#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 36
Default Function Help

I would like to design a function that will select a range of cells and
assign an alternating color (light gray & no fill) to the rows within that
selection after a copy, cut or paste operation occurs. Anyone have any ideas?

Thanks,

Kevin
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 79
Default Function Help

Did you try Conditional Format using formula?
Something like this: "MOD(ROW();2)=1"

Rodrigo Ferreira


"kmwhitt" escreveu na mensagem
...
I would like to design a function that will select a range of cells and
assign an alternating color (light gray & no fill) to the rows within that
selection after a copy, cut or paste operation occurs. Anyone have any
ideas?

Thanks,

Kevin



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 36
Default Function Help

Yes, I did. I even recorded a macro:

Sub Color_Band()
Range("A16:P555").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=MOD(ROW(),2)=1"
Selection.FormatConditions(1).Interior.ColorIndex = 15
Range("A16").Select
End Sub

Where would I insert this within the worksheet's code to insure it is run
everytime a copy, cut or paste event takes place. In fact, I only want it to
happen after a copy, cut or paste event occurs.

"Rodrigo Ferreira" wrote:

Did you try Conditional Format using formula?
Something like this: "MOD(ROW();2)=1"

Rodrigo Ferreira


"kmwhitt" escreveu na mensagem
...
I would like to design a function that will select a range of cells and
assign an alternating color (light gray & no fill) to the rows within that
selection after a copy, cut or paste operation occurs. Anyone have any
ideas?

Thanks,

Kevin




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,572
Default Function Help

Since you said *after* a copy, cut or paste operation, you might try this:

While the range is *still* selected from the paste,
<Format <Auto Format
And pick one of the styles that you see there.

You could also use Conditional Formatting, which will *retain* the
formatting even if you subsequently insert or delete rows.

While the range is *still* selected from the paste,
<Format <Conditional Formatting,
Change "Cell Value Is" to
"Formula Is",
And enter this formula to shade *even* numbered rows:

=MOD(ROW(),2)=0

OR this one for *odd* numbered rows:

=MOD(ROW(),2)=1

Then click on "Format", and choose whatever you like.
--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------


"kmwhitt" wrote in message
...
I would like to design a function that will select a range of cells and
assign an alternating color (light gray & no fill) to the rows within that
selection after a copy, cut or paste operation occurs. Anyone have any
ideas?

Thanks,

Kevin


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 36
Default Function Help

Hi RagDyer:

I'm not following you. I am creating a pricing utility. The user may need
to copy a row of data (or just a few cells) and paste it into another line
item. When this happens, the alternating colored rows get all bungled up.
How can I make Excel keep the format in this range constant no matter what
type of cut, copy or paste event takes place?

I was thinking a function that runs under _change that resets the
conditional formatting you suggested below. Any ideas?

Thanks,

Kevin

"RagDyer" wrote:

Since you said *after* a copy, cut or paste operation, you might try this:

While the range is *still* selected from the paste,
<Format <Auto Format
And pick one of the styles that you see there.

You could also use Conditional Formatting, which will *retain* the
formatting even if you subsequently insert or delete rows.

While the range is *still* selected from the paste,
<Format <Conditional Formatting,
Change "Cell Value Is" to
"Formula Is",
And enter this formula to shade *even* numbered rows:

=MOD(ROW(),2)=0

OR this one for *odd* numbered rows:

=MOD(ROW(),2)=1

Then click on "Format", and choose whatever you like.
--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------


"kmwhitt" wrote in message
...
I would like to design a function that will select a range of cells and
assign an alternating color (light gray & no fill) to the rows within that
selection after a copy, cut or paste operation occurs. Anyone have any
ideas?

Thanks,

Kevin





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,572
Default Function Help

First of all, I can't help you with anything pertaining to code or VBA.

But as far as using the Conditional Formatting type of banding, if you
"PasteSpecial" - "Values" (so no formats of the copied cells will override
the banding format), the Conditional Formatting type of banding will remain
in force through the pasting process.
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"kmwhitt" wrote in message
...
Hi RagDyer:

I'm not following you. I am creating a pricing utility. The user may
need
to copy a row of data (or just a few cells) and paste it into another line
item. When this happens, the alternating colored rows get all bungled up.
How can I make Excel keep the format in this range constant no matter what
type of cut, copy or paste event takes place?

I was thinking a function that runs under _change that resets the
conditional formatting you suggested below. Any ideas?

Thanks,

Kevin

"RagDyer" wrote:

Since you said *after* a copy, cut or paste operation, you might try
this:

While the range is *still* selected from the paste,
<Format <Auto Format
And pick one of the styles that you see there.

You could also use Conditional Formatting, which will *retain* the
formatting even if you subsequently insert or delete rows.

While the range is *still* selected from the paste,
<Format <Conditional Formatting,
Change "Cell Value Is" to
"Formula Is",
And enter this formula to shade *even* numbered rows:

=MOD(ROW(),2)=0

OR this one for *odd* numbered rows:

=MOD(ROW(),2)=1

Then click on "Format", and choose whatever you like.
--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------


"kmwhitt" wrote in message
...
I would like to design a function that will select a range of cells and
assign an alternating color (light gray & no fill) to the rows within
that
selection after a copy, cut or paste operation occurs. Anyone have any
ideas?

Thanks,

Kevin




  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 36
Default Function Help

Thanks, RagDyer:

The trouble with pastespecial is getting people to actually use it and avoid
messing up the format.....

"RagDyer" wrote:

First of all, I can't help you with anything pertaining to code or VBA.

But as far as using the Conditional Formatting type of banding, if you
"PasteSpecial" - "Values" (so no formats of the copied cells will override
the banding format), the Conditional Formatting type of banding will remain
in force through the pasting process.
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"kmwhitt" wrote in message
...
Hi RagDyer:

I'm not following you. I am creating a pricing utility. The user may
need
to copy a row of data (or just a few cells) and paste it into another line
item. When this happens, the alternating colored rows get all bungled up.
How can I make Excel keep the format in this range constant no matter what
type of cut, copy or paste event takes place?

I was thinking a function that runs under _change that resets the
conditional formatting you suggested below. Any ideas?

Thanks,

Kevin

"RagDyer" wrote:

Since you said *after* a copy, cut or paste operation, you might try
this:

While the range is *still* selected from the paste,
<Format <Auto Format
And pick one of the styles that you see there.

You could also use Conditional Formatting, which will *retain* the
formatting even if you subsequently insert or delete rows.

While the range is *still* selected from the paste,
<Format <Conditional Formatting,
Change "Cell Value Is" to
"Formula Is",
And enter this formula to shade *even* numbered rows:

=MOD(ROW(),2)=0

OR this one for *odd* numbered rows:

=MOD(ROW(),2)=1

Then click on "Format", and choose whatever you like.
--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------


"kmwhitt" wrote in message
...
I would like to design a function that will select a range of cells and
assign an alternating color (light gray & no fill) to the rows within
that
selection after a copy, cut or paste operation occurs. Anyone have any
ideas?

Thanks,

Kevin




  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22
Default Function Help

kmwhitt wrote:
Hi RagDyer:

I'm not following you. I am creating a pricing utility. The user may need
to copy a row of data (or just a few cells) and paste it into another line
item. When this happens, the alternating colored rows get all bungled up.
How can I make Excel keep the format in this range constant no matter what
type of cut, copy or paste event takes place?

I was thinking a function that runs under _change that resets the
conditional formatting you suggested below. Any ideas?

Thanks,

Kevin

"RagDyer" wrote:

Since you said *after* a copy, cut or paste operation, you might try this:

While the range is *still* selected from the paste,
<Format <Auto Format
And pick one of the styles that you see there.

You could also use Conditional Formatting, which will *retain* the
formatting even if you subsequently insert or delete rows.

While the range is *still* selected from the paste,
<Format <Conditional Formatting,
Change "Cell Value Is" to
"Formula Is",
And enter this formula to shade *even* numbered rows:

=MOD(ROW(),2)=0

OR this one for *odd* numbered rows:

=MOD(ROW(),2)=1

Then click on "Format", and choose whatever you like.
--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------


"kmwhitt" wrote in message
...
I would like to design a function that will select a range of cells and
assign an alternating color (light gray & no fill) to the rows within that
selection after a copy, cut or paste operation occurs. Anyone have any
ideas?

Thanks,

Kevin



While trying to solve a problem somewhat different from
yours, I came up with this after searching Google groups for
the string:
excel "paste event"

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.CutCopyMode = False Then Exit Sub
Select Case Application.CutCopyMode
Case Is = xlCopy
x = 1
Case Is = xlCut
Application.CutCopyMode = False
MsgBox "Action cancelled"
End Select
End Sub

I am still working on it. You can't use it as it is, but you
might wish to modify it to suit your needs. Whenever x=1,
you would have to modify Copy/Paste to
Copy/PasteSpecial/Values. I've seen several threads dealing
with that (including this one).
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
Need some comments on my Utility_Move class module. jchen Excel Worksheet Functions 0 August 21st 06 07:05 PM
Creating a Custom Excel Function to Calculate Gini Coefficients [email protected] Excel Worksheet Functions 3 February 21st 06 10:15 PM
Date & Time mully New Users to Excel 4 May 23rd 05 11:56 AM
Conversion SVC Excel Worksheet Functions 9 February 28th 05 02:29 PM
HOW CAN I GET OFFICE 2003 EXCEL BASIC TO NEST FUNCTIONS LIKE EXCE. Robert AS Excel Worksheet Functions 4 December 2nd 04 10:49 AM


All times are GMT +1. The time now is 11:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"