monoj chakraborty
Member
Hey good people,
I am trying to design a simple algorithm, which should summarize individual worksheets in a workbook into a topsheet.
The code I have tried to write is as follows :
I have attached the file for quick reference and the code above is under module1 - unfortunately, while the code runs without an error, the values returned are all "FALSE".
I know it has to do with the formula string but am not able to pin it down.
Any help much appreciated in advance
best regds.,
I am trying to design a simple algorithm, which should summarize individual worksheets in a workbook into a topsheet.
The code I have tried to write is as follows :
Code:
Sub consolidate()
'
' pulldata Macro
'
'
Dim asmsheets As Integer 'iterator for looping thru' individual sheets
Dim Topsheetrow As Integer 'select rows for pulling data from asm sheets
Dim Topsheetcol As Integer 'select columns for pulling data from asm sheets
Dim formulastring As String 'string for formula to pull data from the relevant cells from the asm sheets
Dim chooseasm As Integer
Dim asmsheetcol As Integer
Regions = Array("Homanjit", "Alok", "Jitendra", "Vijay", "Karthikeyan") 'array to store asm individual sheets
Worksheets("Topsheet").Activate
For Topsheetrow = 3 To 7
For Topsheetcol = 2 To 7
Cells(Topsheetrow, Topsheetcol).Select
For chooseasm = 0 To 4
Asm = Regions(chooseasm)
Select Case Topsheetcol
Case Is = 2
asmsheetcol = 4
Case Is = 3
asmsheetcol = 13
Case Is = 4
asmsheetcol = 14
Case Is = 5
asmsheetcol = 15
Case Is = 6
asmsheetcol = 24
Case Is = 7
asmsheetcol = 25
End Select
formulastring = "=Asm & " !R" & 33-topsheetrow & "C" & asmsheetcol-topsheetcol"
ActiveCell.FormulaR1C1 = formulastring
Next chooseasm
Next Topsheetcol
Next Topsheetrow
End Sub
I have attached the file for quick reference and the code above is under module1 - unfortunately, while the code runs without an error, the values returned are all "FALSE".
I know it has to do with the formula string but am not able to pin it down.
Any help much appreciated in advance
best regds.,