Thread: Autofill VBA Q
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] seanryanie@yahoo.co.uk is offline
external usenet poster
 
Posts: 73
Default Autofill VBA Q

I have part of VBA code below that Places "1" in B2; then moves to B3 and inserts a formula, essentially if T30,1, B2+1. It then copies this formuala down to last row, but if last Row is B3 I get an error. How do I get around this?

I've tried replacing B3 with B4 but that just puts a value of 3 in B4 when it should be <blank


Range("B2").Formula = "1"
Range("B3").Select
With Selection
.Formula = "=IF(T30,1,B2+1)"
.AutoFill Destination:=Range("B3:B" & Range("B500").End(xlUp).Row)