Thread: offset problems
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tomek[_5_] Tomek[_5_] is offline
external usenet poster
 
Posts: 5
Default offset problems

I only changed the line after .PrintArea=, the preceding lines are unchanged
You should also replace
Sheets("Quote").offset(insertpoint,-5,0).value =

with something like
Range("insertpoint").offset(-5,0).value =
Range("insertpoint").offset(-11,0).value + 1
but check if it works, I didn't

"Tomek" wrote in message
...
try this
Sub addrow()
'
Sheets("Row Template").Range("A1:G6").Copy
Sheets("Quote").Range("insertpoint").Insert Shift:=xlDown
Sheets("Quote").offset(insertpoint,-5,0).value =
(offset(insertpoint,-11,0).value)+1
Sheets("Quote").PageSetup.PrintArea =
"$A$1:" & insertpoint.Offset(1, 6).Address"

End Sub

and put appropriate number of "
I always have problems with that so to avoid it I use one more variable:

Dim s as String
.
'some code here
.
s="$A$1:"
Sheets("Quote").PageSetup.PrintArea = s & insertpoint.Offset(1, 6).Address
.
'some code here