LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Can anyone help with VB please?


Nopes, not a million things, you're almost there.


Sub ReadColours()
Dim wk As Workbook
Set wk = ActiveWorkbook
Dim sht As Worksheet
Set sht = wk.Worksheets("Sheet1")
Dim c As Variant
With sht
For Each c In sht.Range("S2:CD5270")
Debug.Print c.Address
With c.Font
Debug.Print .Name
Debug.Print .ColorIndex & vbCrLf
End With
Next
End With
Set sht = Nothing
Set wk = Nothing
End Sub



"kirkm" schreef in bericht
...
Hi,

I'm way out of my depth and been struggling with this day.

There's probably a million things wrong... I want to step through a
range of cells and print the font name and colour. Eventually I want
to change the colour depending on the number. I can see the cell
contents but everything else is just 'Null'.

It's these 'dot' bits that I don't follow at all. Any help
appreciated.

Thanks - Kirk

-----
Sub ReadColours()

Dim wk As Workbook
Set wk = ActiveWorkbook
Dim sht As Worksheet
Set sht = wk.Worksheets("Sheet1")

Dim c

With sht
For Each c In sht.Range("S2:CD5270")

Debug.Print c
With .Cells.Font
Debug.Print .Name
End With
With .Cells.Interior
Debug.Print .ColorIndex
End With

Next
End With

End Sub



 
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



All times are GMT +1. The time now is 12:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"