Filling cells via code..
Hi
I need to run code that finds all the worksheets in my activeworkbook that have the name "AC Planned Summary" (there could be many with (2) (3) and so on after the name ) and determines if cells C9:C100 are greater than or equal to 0. If C9:C100 have any values greater than or equal to 0, then the corresponding cells in E9:E100 need to have a 0 placed in them via this code. SO if .. C9 , C10 and C11 all have values greater or equal to zero in them..then I would need E9, E10 and E11 to have 0 placed into those cells via this code. I would use formulas.. but I need to determine the last entry in that column..and formulas mess that up.. Thanks in advance for your help!! Kimberly |
Filling cells via code..
Have a hybrid. Create a macro that will insert your IF formula in the
desired range. To determine the range, use something similar to: LastRow = Range("C65536").End(xlup).row Range("e9:e" & LastRow).Formula = "=IF(C9=0,0,"""")" You can use a loop to find all of the summary sheets. Something similar to: for i = 1 to sheets.count if left(sheets(i).name,3) = "AC " then LastRow = Range("C65536").End(xlup).row Range("e9:e" & LastRow).Formula = "=IF(C9=0,0,"""")" end if next -- Damon Longworth Don't miss out on the 2005 Excel User Conference Sept 16th and 17th Stockyards Hotel - Ft. Worth, Texas www.ExcelUserConference.com "KimberlyC" wrote in message ... Hi I need to run code that finds all the worksheets in my activeworkbook that have the name "AC Planned Summary" (there could be many with (2) (3) and so on after the name ) and determines if cells C9:C100 are greater than or equal to 0. If C9:C100 have any values greater than or equal to 0, then the corresponding cells in E9:E100 need to have a 0 placed in them via this code. SO if .. C9 , C10 and C11 all have values greater or equal to zero in them..then I would need E9, E10 and E11 to have 0 placed into those cells via this code. I would use formulas.. but I need to determine the last entry in that column..and formulas mess that up.. Thanks in advance for your help!! Kimberly |
All times are GMT +1. The time now is 05:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com