Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 164
Default Looking for a quick way.

I have roughly 1200 records that I need to change (whatever is here)
including the brackets to italic Any way to do it with a quick macro or is
it going to be a one-at-a-time effort.

--

Regards
Michael Koerner



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,118
Default Looking for a quick way.

If this is a one-time adjustment, how about this:

Select the range of cells
Hold down [Ctrl] and press [F].....that's a shortcut for <edit<find
Find what: (*)
Click the [Find All] button
-That will list ALL found cells, BUT only select ONE
Hold down [Ctrl] and press [A]....that will select EVERY found cell
Click the [Close] button

Hold down [Ctrl] and press [i].....that's a shortcut to set Italics

Is that something you can work with?
******************
Regards,

Ron


"Michael Koerner" wrote in message
...
I have roughly 1200 records that I need to change (whatever is here)
including the brackets to italic Any way to do it with a quick macro or is
it going to be a one-at-a-time effort.

--

Regards
Michael Koerner





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 164
Default Looking for a quick way.

Ron;

That would work, but it italicise the whole cell. I just want to italicise
what is bracketed

--

Regards
Michael Koerner


"Ron Coderre" wrote in message
...[i]
If this is a one-time adjustment, how about this:

Select the range of cells
Hold down [Ctrl] and press [F].....that's a shortcut for <edit<find
Find what: (*)
Click the [Find All] button
-That will list ALL found cells, BUT only select ONE
Hold down [Ctrl] and press [A]....that will select EVERY found cell
Click the [Close] button

Hold down [Ctrl] and press .....that's a shortcut to set Italics

Is that something you can work with?
******************
Regards,

Ron


"Michael Koerner" wrote in message
...
I have roughly 1200 records that I need to change (whatever is here)
including the brackets to italic Any way to do it with a quick macro or is
it going to be a one-at-a-time effort.

--

Regards
Michael Koerner







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Looking for a quick way.

It's gonna be a cell by cell effort.

If you only have one set of parens, you may want to look at instr() to find
each.

Option Explicit
Sub testme()
Dim myRng As Range
Dim myCell As Range
Dim StartPos As Long
Dim LastPos As Long

Set myRng = Selection

For Each myCell In myRng.Cells
StartPos = InStr(1, myCell.Value, "(", vbTextCompare)
LastPos = InStr(1, myCell.Value, ")", vbTextCompare)

If StartPos * LastPos 0 Then
If StartPos < LastPos Then
With myCell.Characters _
(Start:=StartPos, Length:=LastPos - StartPos + 1)
.Font.FontStyle = "Italic"
End With
End If
End If
Next myCell

End Sub



Michael Koerner wrote:

I have roughly 1200 records that I need to change (whatever is here)
including the brackets to italic Any way to do it with a quick macro or is
it going to be a one-at-a-time effort.

--

Regards
Michael Koerner


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Looking for a quick way.

After I posted, I realized that going cell by cell would be a waste if most
cells don't have parentheses in them.

Option Explicit
Sub testme()
Dim myRng As Range
Dim myCell As Range
Dim StartPos As Long
Dim LastPos As Long
Dim FoundCell As Range
Dim FirstAddress As String
Dim AllFoundCells As Range

Set myRng = Selection

With myRng
Set FoundCell = .Find(what:="(", _
LookIn:=xlValues, lookat:=xlPart, _
after:=.Cells(.Cells.Count))

If FoundCell Is Nothing Then
MsgBox "Nothing to fix"
Else
Set AllFoundCells = FoundCell
FirstAddress = FoundCell.Address
Do
If AllFoundCells Is Nothing Then
Set AllFoundCells = FoundCell
Else
Set AllFoundCells = Union(FoundCell, AllFoundCells)
End If
Set FoundCell = .FindNext(FoundCell)

If FoundCell.Address = FirstAddress Then
Exit Do
End If
Loop

For Each myCell In AllFoundCells.Cells
StartPos = InStr(1, myCell.Value, "(", vbTextCompare)
LastPos = InStr(1, myCell.Value, ")", vbTextCompare)

If LastPos 0 Then
If StartPos < LastPos Then
With myCell.Characters(Start:=StartPos, _
Length:=LastPos - StartPos + 1)
.Font.FontStyle = "Italic"
End With
End If
End If
Next myCell

End If

End With

End Sub



Michael Koerner wrote:

I have roughly 1200 records that I need to change (whatever is here)
including the brackets to italic Any way to do it with a quick macro or is
it going to be a one-at-a-time effort.

--

Regards
Michael Koerner


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 164
Default Looking for a quick way.

Dave;

Thanks very much, worked like a charm. You don't know how many bottles of
wine you saved me going through if I would have had to do in manually. <g

--

Regards
Michael Koerner


"Dave Peterson" wrote in message
...
After I posted, I realized that going cell by cell would be a waste if
most
cells don't have parentheses in them.

Option Explicit
Sub testme()
Dim myRng As Range
Dim myCell As Range
Dim StartPos As Long
Dim LastPos As Long
Dim FoundCell As Range
Dim FirstAddress As String
Dim AllFoundCells As Range

Set myRng = Selection

With myRng
Set FoundCell = .Find(what:="(", _
LookIn:=xlValues, lookat:=xlPart, _
after:=.Cells(.Cells.Count))

If FoundCell Is Nothing Then
MsgBox "Nothing to fix"
Else
Set AllFoundCells = FoundCell
FirstAddress = FoundCell.Address
Do
If AllFoundCells Is Nothing Then
Set AllFoundCells = FoundCell
Else
Set AllFoundCells = Union(FoundCell, AllFoundCells)
End If
Set FoundCell = .FindNext(FoundCell)

If FoundCell.Address = FirstAddress Then
Exit Do
End If
Loop

For Each myCell In AllFoundCells.Cells
StartPos = InStr(1, myCell.Value, "(", vbTextCompare)
LastPos = InStr(1, myCell.Value, ")", vbTextCompare)

If LastPos 0 Then
If StartPos < LastPos Then
With myCell.Characters(Start:=StartPos, _
Length:=LastPos - StartPos + 1)
.Font.FontStyle = "Italic"
End With
End If
End If
Next myCell

End If

End With

End Sub



Michael Koerner wrote:

I have roughly 1200 records that I need to change (whatever is here)
including the brackets to italic Any way to do it with a quick macro or
is
it going to be a one-at-a-time effort.

--

Regards
Michael Koerner


--

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
Need Help Quick nevans Excel Discussion (Misc queries) 2 August 7th 09 03:48 PM
Help quick nempo Excel Worksheet Functions 3 July 20th 06 10:22 PM
I need quick help please! Sutemi Charts and Charting in Excel 1 June 8th 06 08:51 AM
Quick question - quick answer about assigning shortcut keys funkymonkUK[_75_] Excel Programming 1 October 13th 05 10:50 AM
NEED HELP QUICK AGAIN! The_ tone Excel Discussion (Misc queries) 0 May 10th 05 07:20 PM


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