H
HH
I use the following code behind a command button to populate a "SignOutLog"
worksheet from about 35 worksheets in a workbook containing about 45
worksheets:
Sub SignOutLog()
'
' MakeSummary Macro
' Macro created 6/12/2006 by Maniac
'
'
Sheets("SignOutLog").Select
' Clear the existing values (if any)
Range("$A$2:$p$60").Value = " "
' J tracks the row number on the summary page
' I tracks the sheet number being processed
j = 2
For I = 2 To Sheets.Count
a$ = Sheets(I).Name
' Don't process a sheet if its name Other than "SignOutLog"
' or if the name is blank.
If (a$ = "Birthday") Then GoTo 10
If (a$ = "DepositRecord") Then GoTo 10
If (a$ = "MailLabels") Then GoTo 10
If (a$ = "PmtSummary") Then GoTo 10
If (a$ = "Templat") Then GoTo 10
If (a$ = "ID") Then GoTo 10
If (a$ = "SignOutLog") Then GoTo 10
If (a$ = "DepositRecord") Then GoTo 10
If (a$ = "Photos") Then GoTo 10
If (a$ = "Volunteers") Then GoTo 10
If (Sheets(a$).Range("$C$1").Value = "") Then GoTo 10
' Process the current sheet
Range("g" + Format(j)).FormulaR1C1 = "='" + a$ + "'!R6C3"
Range("e" + Format(j)).FormulaR1C1 = "='" + a$ + "'!R6C4"
Range("f" + Format(j)).FormulaR1C1 = "='" + a$ + "'!R6C14"
Range("k" + Format(j)).FormulaR1C1 = "='" + a$ + "'!R9C9"
Range("h" + Format(j)).FormulaR1C1 = "='" + a$ + "'!R44C11"
j = j + 1
10 Next I
End Sub
The code has always worked great until I added the last line --- Range("h"
+ Format(j)).FormulaR1C1 = "='" + a$ + "'!R44C11" --
Now when I run the macro I get the formula in the cell rather than the
value. To be more precise, I get the formula the second time I run the
code. The first time I push the command button the code runs great. I have
been able to get the code to run properly by formatting the column to
"general," but still the second time I run the code the formula appears in
the cells rather than the value.
Only the new column is doing this. The other 4 columns are displaying the
values each time I run the code.
Very confusing.... Where Have I Gone Wrong??
Hank
worksheet from about 35 worksheets in a workbook containing about 45
worksheets:
Sub SignOutLog()
'
' MakeSummary Macro
' Macro created 6/12/2006 by Maniac
'
'
Sheets("SignOutLog").Select
' Clear the existing values (if any)
Range("$A$2:$p$60").Value = " "
' J tracks the row number on the summary page
' I tracks the sheet number being processed
j = 2
For I = 2 To Sheets.Count
a$ = Sheets(I).Name
' Don't process a sheet if its name Other than "SignOutLog"
' or if the name is blank.
If (a$ = "Birthday") Then GoTo 10
If (a$ = "DepositRecord") Then GoTo 10
If (a$ = "MailLabels") Then GoTo 10
If (a$ = "PmtSummary") Then GoTo 10
If (a$ = "Templat") Then GoTo 10
If (a$ = "ID") Then GoTo 10
If (a$ = "SignOutLog") Then GoTo 10
If (a$ = "DepositRecord") Then GoTo 10
If (a$ = "Photos") Then GoTo 10
If (a$ = "Volunteers") Then GoTo 10
If (Sheets(a$).Range("$C$1").Value = "") Then GoTo 10
' Process the current sheet
Range("g" + Format(j)).FormulaR1C1 = "='" + a$ + "'!R6C3"
Range("e" + Format(j)).FormulaR1C1 = "='" + a$ + "'!R6C4"
Range("f" + Format(j)).FormulaR1C1 = "='" + a$ + "'!R6C14"
Range("k" + Format(j)).FormulaR1C1 = "='" + a$ + "'!R9C9"
Range("h" + Format(j)).FormulaR1C1 = "='" + a$ + "'!R44C11"
j = j + 1
10 Next I
End Sub
The code has always worked great until I added the last line --- Range("h"
+ Format(j)).FormulaR1C1 = "='" + a$ + "'!R44C11" --
Now when I run the macro I get the formula in the cell rather than the
value. To be more precise, I get the formula the second time I run the
code. The first time I push the command button the code runs great. I have
been able to get the code to run properly by formatting the column to
"general," but still the second time I run the code the formula appears in
the cells rather than the value.
Only the new column is doing this. The other 4 columns are displaying the
values each time I run the code.
Very confusing.... Where Have I Gone Wrong??
Hank