Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Modify code from paste values to change font color / multiple rang

Hi,

I was wondering if you could help me out modify a code that currently paste
values to change the font color to automatic or black and to add multiple
ranges (new ranges are E8:E17, E24:E33,E40:E49 and E56:E81)

The current code is below and works Great! Thanks to everyone that
helped/will help me out!!

Sub PVPrImpct()

With Range("b48:b74").Offset(, Worksheets( _
"Summary by month MTD").Range("A4") - 1)
.Value = .Value
End With
End Sub

Thanks again!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Modify code from paste values to change font color / multiple rang

I'm not sure if those ranges are before the offset or after...

Maybe something like this will give you an idea:

Option Explicit
Sub PVPrImpct()

Dim myArea As Range
Dim HowManyCols As Long
Dim myRng As Range

HowManyCols = Worksheets("Summary by month MTD").Range("A4").Value - 1

Set myRng = ActiveSheet.Range("b48:b74,E8:E17,E24:E33,E40:E49, E56:E81")

For Each myArea In myRng.Offset(0, HowManyCols).Areas
With myArea
.Value = .Value
End With
Next myArea

End Sub


Nina wrote:

Hi,

I was wondering if you could help me out modify a code that currently paste
values to change the font color to automatic or black and to add multiple
ranges (new ranges are E8:E17, E24:E33,E40:E49 and E56:E81)

The current code is below and works Great! Thanks to everyone that
helped/will help me out!!

Sub PVPrImpct()

With Range("b48:b74").Offset(, Worksheets( _
"Summary by month MTD").Range("A4") - 1)
.Value = .Value
End With
End Sub

Thanks again!


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Modify code from paste values to change font color / multiple

Hi Dave - thanks for your help. I have not tested yet, but instead of pasting
values I would need it to change the font color to black or automatic. Thank
you so much again!

"Dave Peterson" wrote:

I'm not sure if those ranges are before the offset or after...

Maybe something like this will give you an idea:

Option Explicit
Sub PVPrImpct()

Dim myArea As Range
Dim HowManyCols As Long
Dim myRng As Range

HowManyCols = Worksheets("Summary by month MTD").Range("A4").Value - 1

Set myRng = ActiveSheet.Range("b48:b74,E8:E17,E24:E33,E40:E49, E56:E81")

For Each myArea In myRng.Offset(0, HowManyCols).Areas
With myArea
.Value = .Value
End With
Next myArea

End Sub


Nina wrote:

Hi,

I was wondering if you could help me out modify a code that currently paste
values to change the font color to automatic or black and to add multiple
ranges (new ranges are E8:E17, E24:E33,E40:E49 and E56:E81)

The current code is below and works Great! Thanks to everyone that
helped/will help me out!!

Sub PVPrImpct()

With Range("b48:b74").Offset(, Worksheets( _
"Summary by month MTD").Range("A4") - 1)
.Value = .Value
End With
End Sub

Thanks again!


--

Dave Peterson
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Modify code from paste values to change font color / multiple

Record a macro when you change the font color to automatic and I bet you'll see
where to add it to your code.

If you need help, post back and explain what those ranges are (I'm still
confused).

Nina wrote:

Hi Dave - thanks for your help. I have not tested yet, but instead of pasting
values I would need it to change the font color to black or automatic. Thank
you so much again!

"Dave Peterson" wrote:

I'm not sure if those ranges are before the offset or after...

Maybe something like this will give you an idea:

Option Explicit
Sub PVPrImpct()

Dim myArea As Range
Dim HowManyCols As Long
Dim myRng As Range

HowManyCols = Worksheets("Summary by month MTD").Range("A4").Value - 1

Set myRng = ActiveSheet.Range("b48:b74,E8:E17,E24:E33,E40:E49, E56:E81")

For Each myArea In myRng.Offset(0, HowManyCols).Areas
With myArea
.Value = .Value
End With
Next myArea

End Sub


Nina wrote:

Hi,

I was wondering if you could help me out modify a code that currently paste
values to change the font color to automatic or black and to add multiple
ranges (new ranges are E8:E17, E24:E33,E40:E49 and E56:E81)

The current code is below and works Great! Thanks to everyone that
helped/will help me out!!

Sub PVPrImpct()

With Range("b48:b74").Offset(, Worksheets( _
"Summary by month MTD").Range("A4") - 1)
.Value = .Value
End With
End Sub

Thanks again!


--

Dave Peterson
.


--

Dave Peterson
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
code to change font color of row Mark Kubicki Excel Programming 0 December 29th 08 11:29 PM
How to change font color on string/text values [email protected] Excel Programming 2 March 31st 08 12:28 PM
Modify Font from this code. Possible ? Corey Excel Programming 0 January 5th 07 04:19 AM
Can I modify cell attributes (font,color etc.) based on function . TicklePig Excel Discussion (Misc queries) 4 December 4th 05 04:23 AM
Modify this code to paste special, values Jonsson[_41_] Excel Programming 4 September 5th 04 10:03 PM


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