Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help! - Formatting Oddity
I've tried everything I can think of to resolve this problem and suspect it may some obvious rule that I'm overlooking. I have a workbook with several worksheets that contain VBA procedures that make updates from our Help Desk SQL Server database. Some of these worksheets are updated every minute from a clock procedure
Several of these worksheets are for reporting purposes and are updated only by running a procedure from a command button. Here's my problem On one of these worksheets there is a column that is populated from the SQL database and I have formatted the column cells to be in the Number format. When the Clock procedure is fired, several of these cells in the middle of the column change to a Date format! There are cells above and below that remain in the Number format, it's just these few cells in the middle that change to Date format. Keep in mind that these cells (and worksheets) are not being updated when the Clock procedure fires, only the worksheets with procedures called by the Clock procedure I have tried changing the format of the cells back to Number and saving the file and it works - until the Clock procedure fires again. Then these cells in the middle of the column change back to Date format. I can't see anything in my code that would cause this to happen and if there was (such as an implicit conversion), wouldn't it change the whole column I've tried to copy the cells from above into the Date format cells, I've tried clearing everything with the Edit command, I've tried formatting the cells in code before the SQL update is run (but that would happen only if the Report command button was clicked). All to no avail. It changes only until the Clock procedure fires and I'm right back to square one Can anyone offer something that I may be overlooking? This thing is driving me crazy! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help! - Formatting Oddity
Annoying, I bet. Why not go with the flow and just add a
couple lines at the end of your procedure to select that column and format it the way you want it? -----Original Message----- I've tried everything I can think of to resolve this problem and suspect it may some obvious rule that I'm overlooking. I have a workbook with several worksheets that contain VBA procedures that make updates from our Help Desk SQL Server database. Some of these worksheets are updated every minute from a clock procedure. Several of these worksheets are for reporting purposes and are updated only by running a procedure from a command button. Here's my problem: On one of these worksheets there is a column that is populated from the SQL database and I have formatted the column cells to be in the Number format. When the Clock procedure is fired, several of these cells in the middle of the column change to a Date format! There are cells above and below that remain in the Number format, it's just these few cells in the middle that change to Date format. Keep in mind that these cells (and worksheets) are not being updated when the Clock procedure fires, only the worksheets with procedures called by the Clock procedure. I have tried changing the format of the cells back to Number and saving the file and it works - until the Clock procedure fires again. Then these cells in the middle of the column change back to Date format. I can't see anything in my code that would cause this to happen and if there was (such as an implicit conversion), wouldn't it change the whole column? I've tried to copy the cells from above into the Date format cells, I've tried clearing everything with the Edit command, I've tried formatting the cells in code before the SQL update is run (but that would happen only if the Report command button was clicked). All to no avail. It changes only until the Clock procedure fires and I'm right back to square one. Can anyone offer something that I may be overlooking? This thing is driving me crazy! . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help! - Formatting Oddity
Good point... I guess since this is my first attempt at programming anything I wanted to write as efficient code as possible. I'm also wary of the Clock procedure updates affecting performance. This workbook currently has seven sheets and until I optimized it the sheets would "blink" several times each minute during the Clock procedure update.
|
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help! - Formatting Oddity
Oh my god! I just tried adding the format code as Larry suggested and it does the same thing! The first run through the code insures that all of the cells are in the Number format. But once the Clock procedure fires then those same cells in the middle of the column change back to a Date format. Even though the format code is in the Clock procedure
What would cause it to do this?!! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help! - Formatting Oddity
OK, I found another piece to the puzzle. The code to change the number format works if I don't have the worksheet with the problem cells selected. If I am viewing the worksheet when the Clock procedure fires then the problem cells change back to the Date format
I would really appreciate any further suggestions on how to solve this problem. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
A rounding oddity | Excel Worksheet Functions | |||
OFFSET oddity | Excel Worksheet Functions | |||
An oddity if not a bug | Excel Worksheet Functions | |||
Chart oddity | Charts and Charting in Excel | |||
Modal oddity | Excel Programming |