Modify code from paste values to change font color / multiple rang

N

Nina

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!
 
D

Dave Peterson

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
 
N

Nina

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!
 
D

Dave Peterson

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top