pythonruby
New Member
- Joined
- Jun 20, 2013
- Messages
- 42
Hi, I keep getting errors with this vba code. I'm trying to make 10 new worksheets with the name of each worksheet in the Newname array. I'm trying to put the same formula (with the difference that each formula would take from a different "Newname" file. I'm trying to put firstformula from A1 to A 560 and secondformula from B1 to B 560.
Sub Namesheetformula()
For x = 1 to 10
Newname = Choose(x,"A","B","c","d","e","f","g","h","i","j")
Firstformula = if(isna(match('Master!'A1,'Newname'!A1:A560,0),"",'Master'!A1)
Secondformula = if(isna(match('Master!'A1,'New'!A1:A560,0),"",index('Newname'!A1:A1000,match('Master!'A1,'Newname'!A1:A560,0)))
Sheets(Sheets.count).Name = Newname
ws.Range("A1:A560").Formula = Firstformula
ws.Range("B1:B560").Formula = Secondformula
End Sub[TABLE="width: 65"]
<colgroup><col width="65" style="width:65pt"> </colgroup><tbody>[TR]
<!--StartFragment--> [TD="width: 65"][/TD]
<!--EndFragment--> [/TR]
</tbody>[/TABLE]
Thank you!
Sub Namesheetformula()
For x = 1 to 10
Newname = Choose(x,"A","B","c","d","e","f","g","h","i","j")
Firstformula = if(isna(match('Master!'A1,'Newname'!A1:A560,0),"",'Master'!A1)
Secondformula = if(isna(match('Master!'A1,'New'!A1:A560,0),"",index('Newname'!A1:A1000,match('Master!'A1,'Newname'!A1:A560,0)))
Sheets(Sheets.count).Name = Newname
ws.Range("A1:A560").Formula = Firstformula
ws.Range("B1:B560").Formula = Secondformula
End Sub[TABLE="width: 65"]
<colgroup><col width="65" style="width:65pt"> </colgroup><tbody>[TR]
<!--StartFragment--> [TD="width: 65"][/TD]
<!--EndFragment--> [/TR]
</tbody>[/TABLE]
Thank you!