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

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

"cornishbloke" wrote in message
...
Just when I thought I was getting better at using VBA I get stuck on
something that I'm sure should be simple :( :

I think it should be change to something like:-

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