Hi,
I have this code to insert my formula and fill down the column.
wsFirst.Range("AQ3:AQ" & Cells(Rows.Count, 1).End(xlUp).Row).Formula = "=IF(P19=1,1,0)"
The problem is that it stops at 101'st row. I think this is related to the fact that before i created the range "ipi" with 101 values. How to amend this line so it runs until the last row with value in column A in the first sheet.?
This is a part of my whole VBA code
'Add new sheet
Set ws = Worksheets.Add(After:=Sheets(Worksheets.Count))
'Name sheet
ws.Name = "ref1"
'Paste results into new sheet
Range("A1:A101") = WorksheetFunction.Transpose(result())
'Name cell range
Range("A1:A101").Name = "ipi"
'set variable to first sheet in workbook
Set wsFirst = Worksheets(1)
'insert row
wsFirst.Rows(1).Insert
'Set headings on AA1,AB1 & AC1
wsFirst.Range("AQ2:AS2") = Array("One", "Two", "Three")
'insert formulas
wsFirst.Range("AQ3:AQ" & Cells(Rows.Count, 1).End(xlUp).Row).Formula = "=IF(P19=1,1,0)"
I have this code to insert my formula and fill down the column.
wsFirst.Range("AQ3:AQ" & Cells(Rows.Count, 1).End(xlUp).Row).Formula = "=IF(P19=1,1,0)"
The problem is that it stops at 101'st row. I think this is related to the fact that before i created the range "ipi" with 101 values. How to amend this line so it runs until the last row with value in column A in the first sheet.?
This is a part of my whole VBA code
'Add new sheet
Set ws = Worksheets.Add(After:=Sheets(Worksheets.Count))
'Name sheet
ws.Name = "ref1"
'Paste results into new sheet
Range("A1:A101") = WorksheetFunction.Transpose(result())
'Name cell range
Range("A1:A101").Name = "ipi"
'set variable to first sheet in workbook
Set wsFirst = Worksheets(1)
'insert row
wsFirst.Rows(1).Insert
'Set headings on AA1,AB1 & AC1
wsFirst.Range("AQ2:AS2") = Array("One", "Two", "Three")
'insert formulas
wsFirst.Range("AQ3:AQ" & Cells(Rows.Count, 1).End(xlUp).Row).Formula = "=IF(P19=1,1,0)"