Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Copy partial cell character format(s) from one cell to another - an example

Hello,
No question here just a procedure for the archive.

Sub CopyInternalCellFormatToOtherCells()

'Copy the full or partial internal format of a cell to other targeted
cells.

'Procedure is meant to copy formats that the Excel Format Painter
cannot
'transfer to other cells (e.g., partial italics of cell contents- some
characters are
italicized and other characters are not).

Dim TargetCell, TargetRange As Range
Dim i As Integer

On Error Resume Next
Set TargetCell = Application.InputBox( _
prompt:="Select ONE Cell to Copy Its Format to
other Cells ", Type:=8)
Set TargetRange = Application.InputBox( _
prompt:="Select Cells You Wish to Format",
Type:=8)

'Check for empty value or empty range selection for TargetCell
If IsEmpty(TargetCell.Value) Then
Exit Sub
End If



For i = 1 To Len(TargetCell.Value)

'Test each character in TargetCell to see if it meets criteria
below:
'Note: currently this test is for just one condition. You could
test
'for two or more conditions by using an "AND" statement in
conjunction
'with the type of character formatting you desire.

If TargetCell.Characters(Start:=i, Length:=1).Font.FontStyle =
"Bold" Then

'If criteria is met, apply format(s) specified below to all
characters
'in TargetRange in same position of character in TargetCell
'Edit formatting application as desired below:

For Each cell In TargetRange
With cell.Characters(Start:=i, Length:=1).Font
' .Name = "Arial"
.FontStyle = "Bold"
'"Regular" or "Bold Italic"
' .Size = 10
' .Strikethrough = False
' .Superscript = False
' .Subscript = False
' .OutlineFont = False
' .Shadow = False
' .Underline =
xlUnderlineStyleNone
' .ColorIndex = xlAutomatic
End With
Next cell
End If

Next i

End Sub

search criteria: copy partial cell formatting partial cell format
painter limitation
copy partial cell formats from one cell to another cell format
limitation mass cell formatting
overcome format painter limitation solution

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
replace a single character WITH FORMAT in a cell ela Excel Worksheet Functions 9 February 24th 10 03:30 AM
Excel 2003 Cell & Character Color and Copy Sound Vallerie Excel Discussion (Misc queries) 0 April 30th 08 12:18 PM
Find partial cell format icq_giggles Excel Discussion (Misc queries) 7 July 21st 07 12:02 AM
How do I copy data in single cell format to a merged cell format Paul Excel Discussion (Misc queries) 1 June 27th 05 11:00 AM
copy paste cell character limit Fred Excel Discussion (Misc queries) 1 December 2nd 04 08:58 PM


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