PC Review


Reply
Thread Tools Rate Thread

How to copyConditional Formats

 
 
Phil Smith
Guest
Posts: n/a
 
      20th Oct 2009
I have a macro/code which will apply a different Conditional Format to
each of four specific consequitive cells. (R2:U2)

I also have this macro set up simple "Pick from the list" Data
Validation in those same cells.

Now I want to copy those four conditional formats and Data Validation
settings all the way down until the end of the data.

There is no data in any of these coloumns, but there is data one coloum
to the left.
The number of rows will vary considerably each time this macro is run.
If I were to do this by keyoard I would copy R2:U2,
go to Q2, [end][down][right], then
[shifton][right][right][right][end][up][down][enter]

I am sure that I can work this movement out in a macro with out too much
problem.

My biggest problem would be copying and pasting just conditional formats
and Data Validations settings.

Unless there is an all around easier way to do this?

This spreadsheet, (all 24 of them) will be coming from Access.

Phil



 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      20th Oct 2009
Dim LastRow as long

with worksheets("somesheetname")
lastrow = .cells(.rows.count,"Q").end(xlup).row
'apply your CF these:
.range("r2:r" & lastrow)...
.range("s2:s" & lastrow)...
.range("t2:t" & lastrow)...
.range("u2:u" & lastrow)...




Phil Smith wrote:
>
> I have a macro/code which will apply a different Conditional Format to
> each of four specific consequitive cells. (R2:U2)
>
> I also have this macro set up simple "Pick from the list" Data
> Validation in those same cells.
>
> Now I want to copy those four conditional formats and Data Validation
> settings all the way down until the end of the data.
>
> There is no data in any of these coloumns, but there is data one coloum
> to the left.
> The number of rows will vary considerably each time this macro is run.
> If I were to do this by keyoard I would copy R2:U2,
> go to Q2, [end][down][right], then
> [shifton][right][right][right][end][up][down][enter]
>
> I am sure that I can work this movement out in a macro with out too much
> problem.
>
> My biggest problem would be copying and pasting just conditional formats
> and Data Validations settings.
>
> Unless there is an all around easier way to do this?
>
> This spreadsheet, (all 24 of them) will be coming from Access.
>
> Phil


--

Dave Peterson
 
Reply With Quote
 
Phil Smith
Guest
Posts: n/a
 
      20th Oct 2009
I think I get what to do here.

Question: When I copy CF around, it will automatically adjust the
formulas depending on my adressing.

I assume that I create my target formula for the first cell in the
range, and it will also automatically adjust as it goes down the range?

Also "with" requires an "end with," right?



Dave Peterson wrote:
> Dim LastRow as long
>
> with worksheets("somesheetname")
> lastrow = .cells(.rows.count,"Q").end(xlup).row
> 'apply your CF these:
> .range("r2:r" & lastrow)...
> .range("s2:s" & lastrow)...
> .range("t2:t" & lastrow)...
> .range("u2:u" & lastrow)...
>
>
>
>
> Phil Smith wrote:
>
>>I have a macro/code which will apply a different Conditional Format to
>>each of four specific consequitive cells. (R2:U2)
>>
>>I also have this macro set up simple "Pick from the list" Data
>>Validation in those same cells.
>>
>>Now I want to copy those four conditional formats and Data Validation
>>settings all the way down until the end of the data.
>>
>>There is no data in any of these coloumns, but there is data one coloum
>>to the left.
>> The number of rows will vary considerably each time this macro is run.
>>If I were to do this by keyoard I would copy R2:U2,
>>go to Q2, [end][down][right], then
>>[shifton][right][right][right][end][up][down][enter]
>>
>>I am sure that I can work this movement out in a macro with out too much
>>problem.
>>
>>My biggest problem would be copying and pasting just conditional formats
>>and Data Validations settings.
>>
>>Unless there is an all around easier way to do this?
>>
>>This spreadsheet, (all 24 of them) will be coming from Access.
>>
>>Phil

>
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      20th Oct 2009
I would expect that to happen--just like excel adjusts the formulas in cells.

But conditional formatting is strange.

See John Walkenbach's site for an example:
http://spreadsheetpage.com/index.php...al_formatting/

And yep, you'll need to add an "end with" (along with lots more code <vbg>) to
make that suggestion close to useful.



Phil Smith wrote:
>
> I think I get what to do here.
>
> Question: When I copy CF around, it will automatically adjust the
> formulas depending on my adressing.
>
> I assume that I create my target formula for the first cell in the
> range, and it will also automatically adjust as it goes down the range?
>
> Also "with" requires an "end with," right?
>
> Dave Peterson wrote:
> > Dim LastRow as long
> >
> > with worksheets("somesheetname")
> > lastrow = .cells(.rows.count,"Q").end(xlup).row
> > 'apply your CF these:
> > .range("r2:r" & lastrow)...
> > .range("s2:s" & lastrow)...
> > .range("t2:t" & lastrow)...
> > .range("u2:u" & lastrow)...
> >
> >
> >
> >
> > Phil Smith wrote:
> >
> >>I have a macro/code which will apply a different Conditional Format to
> >>each of four specific consequitive cells. (R2:U2)
> >>
> >>I also have this macro set up simple "Pick from the list" Data
> >>Validation in those same cells.
> >>
> >>Now I want to copy those four conditional formats and Data Validation
> >>settings all the way down until the end of the data.
> >>
> >>There is no data in any of these coloumns, but there is data one coloum
> >>to the left.
> >> The number of rows will vary considerably each time this macro is run.
> >>If I were to do this by keyoard I would copy R2:U2,
> >>go to Q2, [end][down][right], then
> >>[shifton][right][right][right][end][up][down][enter]
> >>
> >>I am sure that I can work this movement out in a macro with out too much
> >>problem.
> >>
> >>My biggest problem would be copying and pasting just conditional formats
> >>and Data Validations settings.
> >>
> >>Unless there is an all around easier way to do this?
> >>
> >>This spreadsheet, (all 24 of them) will be coming from Access.
> >>
> >>Phil

> >
> >


--

Dave Peterson
 
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
Conditional Formats, how to scroll and view all formats? Bill E Microsoft Excel Worksheet Functions 0 12th May 2010 07:58 PM
Copying formats - column widths, formats, outlining to worksheets =?Utf-8?B?RGF2aWRCcjMxOA==?= Microsoft Excel Worksheet Functions 4 14th Aug 2009 05:03 AM
Conditional formats- paste special formats? =?Utf-8?B?amNhcm5leQ==?= Microsoft Excel Misc 1 1st Nov 2007 06:37 PM
Formats: Too many different cell formats error message vvaidya@pol.net Microsoft Excel Programming 3 1st Feb 2005 01:34 AM
Open Source C# code for file formats in HTML, Word, lit (unprotected), and other formats? news.austin.rr.com Microsoft Dot NET Compact Framework 3 17th Jan 2005 04:29 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:09 PM.