Copy Formats - Excel VBA

Hi All

Quick question here, I was wondering whether it was possible to copy the formats using VBA between two ranges in an anologious fashion to the below (which copies values)

Range(Cells(10, 1), Cells(50, 1)).Value = Range(Cells(10, 2), Cells(50, 2)).Value

ie something along the lines of the below (which doesn't seem to work)

Range(Cells(10, 1), Cells(50, 1)).Format = Range(Cells(10, 2), Cells(50, 2)).Format

Thanks!
Matt
matt_mAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Dave BrettConnect With a Mentor Vice President - Business EvaluationCommented:
soemthing like this

Dave
Range(Cells(10, 1), Cells(50, 1)).Copy
Range(Cells(10, 2), Cells(50, 2)).PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False

Open in new window

0
 
matt_mAuthor Commented:
thanks Dave, I was wondering though if I could do it without a copy paste approach though?
0
 
Dave BrettVice President - Business EvaluationCommented:
you can't :)

The purpose of this line is to remove the copied selection
Application.CutCopyMode = False

So you can hide what has been done, but there isn't an equivalent of the format code that intuition says may be there

Cheers

Dave
0
 
matt_mAuthor Commented:
ok cool, thanks for clearing that one up.
0
All Courses

From novice to tech pro — start learning today.