Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Come selezionare solo celle con font rosso con visualbasic

Ho un'elenco dal quale vorrei selezionare tutte assieme le celle contenenti
il carattere rosso; ho a disposizione excel 2003
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Come selezionare solo celle con font rosso con visualbasic

Video: http://www.jlathamsite.com/uploads/R...ttereRosso.avi

Sub RicercaCarattereRosso()
Dim ChosenCells As Range
Dim LastRow As Long
Dim RowOffset As Long
Dim BaseCell As String
Const Rosso = 3 ' Red

BaseCell = Left(ActiveCell.Address, InStr(2, ActiveCell.Address, "$") -
1) & "65536"
LastRow = Range(BaseCell).End(xlUp).Row
BaseCell = Left(ActiveCell.Address, InStr(2, ActiveCell.Address, "$") -
1) & "1"
On Error Resume Next
Do Until Range(BaseCell).Offset(RowOffset, 0).Row LastRow
If Not (IsEmpty(Range(BaseCell).Offset(RowOffset, 0))) And _
Range(BaseCell).Offset(RowOffset, 0).Font.ColorIndex = Rosso Then
'will error on 1st match
Set ChosenCells = Union(ChosenCells,
Range(BaseCell).Offset(RowOffset, 0))
If Err < 0 Then
Set ChosenCells = Range(BaseCell).Offset(RowOffset, 0)
Err.Clear
End If
End If
RowOffset = RowOffset + 1
Loop
On Error GoTo 0 ' clear trapping
If Not (ChosenCells Is Nothing) Then
ChosenCells.Select
Else
MsgBox "No Matches"
End If

End Sub

"Ivanobrb" wrote:

Ho un'elenco dal quale vorrei selezionare tutte assieme le celle contenenti
il carattere rosso; ho a disposizione excel 2003

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Come selezionare solo celle con font rosso con visualbasic

Video in Media Player may require codec:
( Il video nel lettore multimediale può richiedere il codec: )
http://www.techsmith.com/download/codecs.asp


"JLatham" wrote:

Video: http://www.jlathamsite.com/uploads/R...ttereRosso.avi

Sub RicercaCarattereRosso()
Dim ChosenCells As Range
Dim LastRow As Long
Dim RowOffset As Long
Dim BaseCell As String
Const Rosso = 3 ' Red

BaseCell = Left(ActiveCell.Address, InStr(2, ActiveCell.Address, "$") -
1) & "65536"
LastRow = Range(BaseCell).End(xlUp).Row
BaseCell = Left(ActiveCell.Address, InStr(2, ActiveCell.Address, "$") -
1) & "1"
On Error Resume Next
Do Until Range(BaseCell).Offset(RowOffset, 0).Row LastRow
If Not (IsEmpty(Range(BaseCell).Offset(RowOffset, 0))) And _
Range(BaseCell).Offset(RowOffset, 0).Font.ColorIndex = Rosso Then
'will error on 1st match
Set ChosenCells = Union(ChosenCells,
Range(BaseCell).Offset(RowOffset, 0))
If Err < 0 Then
Set ChosenCells = Range(BaseCell).Offset(RowOffset, 0)
Err.Clear
End If
End If
RowOffset = RowOffset + 1
Loop
On Error GoTo 0 ' clear trapping
If Not (ChosenCells Is Nothing) Then
ChosenCells.Select
Else
MsgBox "No Matches"
End If

End Sub

"Ivanobrb" wrote:

Ho un'elenco dal quale vorrei selezionare tutte assieme le celle contenenti
il carattere rosso; ho a disposizione excel 2003

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
Why is first font action v-e-r-y slow? [email protected] Excel Discussion (Misc queries) 2 March 11th 05 08:01 AM
Embedded Fonts alphaserver Excel Discussion (Misc queries) 5 December 23rd 04 03:42 PM


All times are GMT +1. The time now is 02:08 PM.

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"