K
Kevin
I manipulate a spreadsheet with an external VB program.
My first task is to clear the cells
Next I populate data into the cells
Next to the rows I've copied, there is a formula I'd like to extend to match
the data I put on the worksheet. How can I do this?
Example:
I clear out the range I'm going to populate
' Clear Parameters: Citizenship Section
Set oSheet = oBook.Worksheets("Parameters")
oSheet.Range("I4:J40").Value = ""
Then I populate the spreadsheet from my array
'Transfer the array to the worksheet
oSheet.Range("I4").Resize(iRecordCount, 2).Value = aCitizenshipData
Next I want to extend the formulas that exist on the spreadsheet. I copied
the spreadsheet formulas this way:
' Copy formula cells from spreadsheet.
sFormula1 = oBook.Worksheets("Parameters").Range("K4").Formula
sFormula1 = oBook.Worksheets("Parameters").Range("L4").Formula
formula1 = '=ROUNDUP(J4/5,0)'
formula2 = '=L4'
How can I paste the formulas to the rows below it with VB6. I could write a
looping structure that would autoincrement
the row values but there must be an Excel parameter I can use.
Thanks in advance.
Kevin
Total Max/section Min/section
India 15 3 2
China 8 2 1
PR China Kevin 6 2 1
Japan 4 1 0
Nigeria 4 1 0
South Korea 4 1 0
Canada 3 1 0
Italy 3 1 0
Mexico 3 1 0
Pakistan 3 1 0
Philippines 3 1 0
Singapore 3 1 0
Taiwan 3 1 0
Argentina 2 1 0
Brazil 2 1 0
Peru 2 1 0
Portugal 2 1 0
Republic of Korea 2 1 0
Spain 2 1 0
Turkey 2 1 0
0 -1
My first task is to clear the cells
Next I populate data into the cells
Next to the rows I've copied, there is a formula I'd like to extend to match
the data I put on the worksheet. How can I do this?
Example:
I clear out the range I'm going to populate
' Clear Parameters: Citizenship Section
Set oSheet = oBook.Worksheets("Parameters")
oSheet.Range("I4:J40").Value = ""
Then I populate the spreadsheet from my array
'Transfer the array to the worksheet
oSheet.Range("I4").Resize(iRecordCount, 2).Value = aCitizenshipData
Next I want to extend the formulas that exist on the spreadsheet. I copied
the spreadsheet formulas this way:
' Copy formula cells from spreadsheet.
sFormula1 = oBook.Worksheets("Parameters").Range("K4").Formula
sFormula1 = oBook.Worksheets("Parameters").Range("L4").Formula
formula1 = '=ROUNDUP(J4/5,0)'
formula2 = '=L4'
How can I paste the formulas to the rows below it with VB6. I could write a
looping structure that would autoincrement
the row values but there must be an Excel parameter I can use.
Thanks in advance.
Kevin
Total Max/section Min/section
India 15 3 2
China 8 2 1
PR China Kevin 6 2 1
Japan 4 1 0
Nigeria 4 1 0
South Korea 4 1 0
Canada 3 1 0
Italy 3 1 0
Mexico 3 1 0
Pakistan 3 1 0
Philippines 3 1 0
Singapore 3 1 0
Taiwan 3 1 0
Argentina 2 1 0
Brazil 2 1 0
Peru 2 1 0
Portugal 2 1 0
Republic of Korea 2 1 0
Spain 2 1 0
Turkey 2 1 0
0 -1