Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I got this wonderfully concise bit of code, and for a majority of what I need
it is flawless. Then I was handed another task and thought about reusing this code. Problem is, I am not that bright, and therefore I am unable to get it to function as I want it too. Dim s As String Dim r As Range Dim sht As Worksheet For Each sht In ActiveWorkbook.Sheets For Each r In ActiveSheet.UsedRange s = r.Value If InStr(s, ":") 0 Then r.Value = "0:" & s r.NumberFormat = "[h]:mm:ss" End If Next Next In the end I need it to go through each sheet in the workbook and convert anything with a : in the cell. That part works well enough, what I can not seem to get to work is the switching between the different sheets. Additionally, some of the cells are formulas, and I want to know if there is away that if the code sees a formula it will not try and change the cell at all, except for the .NumberFormat. So, long and short of it. 1) Scan each sheet in a workbook. If the cell contains a €˜: and does not already have a formula, add €˜0: to the beginning of the string. So, is this something that can be done? Thank you in advance for all your help, you have been invaluable. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I change contents of a cell based on drop down list selecte | Excel Worksheet Functions | |||
how to change color of cell based on contents of cell | Excel Discussion (Misc queries) | |||
How to change cell contents based on date? | Excel Discussion (Misc queries) | |||
Change cell color based on contents | Excel Discussion (Misc queries) | |||
Please help! Macro to change cell contents based on cell to the left | Excel Programming |