Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have code that populates a list of cells then applies formating depending
on the content. Like: If APercent 0 And APercent < 100 Then Worksheets("List").Range(Cells(tcnt + 4, 4), Cells(tcnt + 4, 8)).Font.ColorIndex = 10 End If The code works fine when run from within the VB Editor. But if I run it from Excel (menu or button) the cells are populated but the cells are not formated. I have tested that the formatting code is being run. Any ideas of what is going on here? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
SC
Just a guess, but it may be because you have unqualified Cells methods. Depending on where your code is the Cells will be method of the ActiveSheet, not Worksheets("List") With Worksheets("List") .Range(.Cells(tcnt+4,4),.Cells(tcnt+4,8).font etc.. End With Note the period before Cells. I think if this was the problem, then you would get an error, but it's all I could see. -- Dick Kusleika MVP - Excel Excel Blog - Daily Dose of Excel www.dicks-blog.com "SpaceCamel" wrote in message ... I have code that populates a list of cells then applies formating depending on the content. Like: If APercent 0 And APercent < 100 Then Worksheets("List").Range(Cells(tcnt + 4, 4), Cells(tcnt + 4, 8)).Font.ColorIndex = 10 End If The code works fine when run from within the VB Editor. But if I run it from Excel (menu or button) the cells are populated but the cells are not formated. I have tested that the formatting code is being run. Any ideas of what is going on here? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
OK, That did it! Thanks.
Now tell me why it worked from the VBE but didn't from from the App? =================== "Dick Kusleika" wrote: SC Just a guess, but it may be because you have unqualified Cells methods. Depending on where your code is the Cells will be method of the ActiveSheet, not Worksheets("List") With Worksheets("List") .Range(.Cells(tcnt+4,4),.Cells(tcnt+4,8).font etc.. End With Note the period before Cells. I think if this was the problem, then you would get an error, but it's all I could see. -- Dick Kusleika MVP - Excel Excel Blog - Daily Dose of Excel www.dicks-blog.com "SpaceCamel" wrote in message ... I have code that populates a list of cells then applies formating depending on the content. Like: If APercent 0 And APercent < 100 Then Worksheets("List").Range(Cells(tcnt + 4, 4), Cells(tcnt + 4, 8)).Font.ColorIndex = 10 End If The code works fine when run from within the VB Editor. But if I run it from Excel (menu or button) the cells are populated but the cells are not formated. I have tested that the formatting code is being run. Any ideas of what is going on here? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Because while you were in the VBE, sheet "List" was the active sheet?
In article , "SpaceCamel" wrote: Now tell me why it worked from the VBE but didn't from from the App? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VB6 Excel 97 code no longer works if Win2K SP3/4 applied. | Excel Programming | |||
Code works with Excel 2000 but not with Excel 2002 | Excel Programming | |||
Code works with Excel 2000 but not with Excel 2002 | Excel Programming | |||
Code works with Excel 2000 but not with Excel 2002 | Excel Programming | |||
code works in excel 2002, but not in excel 2003 | Excel Programming |