Hi everyone
I want to do a VBA script that will document on sheet2, all of the formulas from sheet1.
I got the loop going (a simple loop for now 5x5). Since I'm able to write to the cell, I'll be able to read it.
But I'm having an issue getting the cell reference from sheet1 to a cell on sheet2
As for the formula, I will use the FORMULATEXT function
That's where I'm stuck.
Thanks in advance.
------------
VBA Code:
-------------------------
I want to do a VBA script that will document on sheet2, all of the formulas from sheet1.
I got the loop going (a simple loop for now 5x5). Since I'm able to write to the cell, I'll be able to read it.
But I'm having an issue getting the cell reference from sheet1 to a cell on sheet2
As for the formula, I will use the FORMULATEXT function
That's where I'm stuck.
Thanks in advance.
------------
VBA Code:
VBA Code:
Sub CycleThrough()
Dim VRows As Integer
Dim VColumns As Integer
For VColumns = 1 To 5
For VRows = 1 To 5
'Worksheets("Sheet1").Cells(Counter, 3).Value = CELL("address",Counter&3)
VColumns2 = CStr(VColumns)
VRows2 = CStr(VRows)
Worksheets("Sheet1").Cells(VColumns, VRows).Value = VColumns2 & "," & VRows2 '(Columns 1st, then Rows)
Next VRows
Next VColumns
End Sub
-------------------------
Document formulas on sheet2.xlsm | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | 1,1 | 1,2 | 1,3 | 1,4 | 1,5 | ||
2 | 2,1 | 2,2 | 2,3 | 2,4 | 2,5 | ||
3 | 3,1 | 3,2 | 3,3 | 3,4 | 3,5 | ||
4 | 4,1 | 4,2 | 4,3 | 4,4 | 4,5 | ||
5 | 5,1 | 5,2 | 5,3 | 5,4 | 5,5 | ||
6 | |||||||
7 | |||||||
8 | Example | A | B | ||||
9 | 1 | AFGSGF | =Z1+Z2 | ||||
10 | 2 | =MATCH(….. | =ETC… | ||||
11 | 3 | =xlookup(…... | AKJDFH | ||||
12 | 4 | ADGFSFG | A;KDLJF= | ||||
13 | 5 | SFGSGF | =ETC… | ||||
14 | |||||||
15 | Output on Sheet 2 | If cell starts with "=", then Column A will have the Cell Reference, and Column B have the formulatext info | |||||
16 | |||||||
17 | A2 | =MATCH(….. | |||||
18 | A3 | =xlookup(…... | |||||
19 | B1 | =Z1+Z2 | |||||
20 | B2 | =ETC… | |||||
21 | B5 | =ETC… | |||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
D17:D18 | D17 | =C10 |
D19:D20 | D19 | =D9 |
D21 | D21 | =D13 |
Attachments
Last edited by a moderator: