Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Option Explicit
Sub test() Dim testrange() Dim fillrange() Dim theusedrange As Range Dim firstrow As Integer, lastrow As Integer, firstcol As Integer, lastcol As Integer Dim i As Integer, j As Integer Dim wks As Worksheet Application.ScreenUpdating = False For Each wks In ActiveWorkbook.Worksheets wks.Activate firstrow = ActiveSheet.UsedRange.Row lastrow = ActiveSheet.UsedRange.Rows.Count + firstrow - 1 firstcol = ActiveSheet.UsedRange.Column lastcol = ActiveSheet.UsedRange.Columns.Count + firstcol - 1 Set theusedrange = Range(Cells(firstrow, firstcol), Cells(lastrow, lastcol)) ReDim testrange(firstrow To lastrow, firstcol To lastcol) ReDim fillrange(firstrow To lastrow, firstcol To lastcol) For i = firstrow To lastrow For j = firstcol To lastcol fillrange(i, j) = Cells(i, j).Formula testrange(i, j) = Cells(i, j).Value If Left(fillrange(i, j), 5) = "=SUM(" Then fillrange(i, j) = testrange(i, j) End If Next j Next i theusedrange.Formula = fillrange Set theusedrange = Nothing Next wks Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
excel replacing my text | Excel Worksheet Functions | |||
Excel - replacing Text in workbooks | Excel Worksheet Functions | |||
Replacing formulas with its value | Excel Worksheet Functions | |||
replacing just the sheet names within formulas | Excel Worksheet Functions | |||
Replacing a number with a description in Excel | Excel Worksheet Functions |