ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   write a macro that changes format of selected cells (https://www.excelbanter.com/excel-programming/357482-write-macro-changes-format-selected-cells.html)

DKY[_112_]

write a macro that changes format of selected cells
 

I need to figure out how to write a macro that will do what Dave
Peterson suggests in this link
http://www.excelforum.com/showthread.php?t=525679
with whatever cells I select. Any ideas?


--
DKY
------------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=527715


Dave Peterson

write a macro that changes format of selected cells
 
Option Explicit
Sub testme()

Dim myCell As Range
Dim myRng As Range
Dim myArea As Range

Set myRng = Selection

Set myCell _
= ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Offset(1, 1)

myCell.Copy
For Each myArea In myRng.Areas
myArea.PasteSpecial Paste:=xlPasteAll, _
Operation:=xlAdd, SkipBlanks:=False, Transpose:=False
Next myArea

Application.CutCopyMode = False
End Sub


DKY wrote:

I need to figure out how to write a macro that will do what Dave
Peterson suggests in this link
http://www.excelforum.com/showthread.php?t=525679
with whatever cells I select. Any ideas?

--
DKY
------------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=527715


--

Dave Peterson

DKY[_113_]

write a macro that changes format of selected cells
 

Well, that works... Thanks again Dave!! I appreciate it

--
DK
-----------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...fo&userid=1451
View this thread: http://www.excelforum.com/showthread.php?threadid=52771



All times are GMT +1. The time now is 11:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com