PDA

View Full Version : Finding Print Area in a excel worksheet



Jade
05-06-2010, 05:13 AM
Hi,

This may seem a bit peculiar but it is interesting indeed.

I am having a cells info like the comment on the cell, its text (cell) value..

I need to know about that in case of a worksheet consists of multiple print areas then that cell will fall under which print area ??

I can post the code also if needed..

Please respond asap...:think:

Thanks,
Jade

mdmackillop
05-06-2010, 05:47 AM
I'm not quite sure if this is what you're after

Option Explicit
Sub PrintArea()
Dim PA, i%, Check As Boolean
' For info
MsgBox Range("Print_Area").Address
PA = Split(Range("Print_Area").Address, ",")
For i = 0 To UBound(PA)
If Not Intersect(Selection, Range(PA(i))) Is Nothing Then
Check = True
Exit For
End If
Next
If Check Then
MsgBox PA(i)
Else
MsgBox "Cell not in print area"
End If
End Sub

Jade
05-06-2010, 06:06 AM
thanks mdmackillop..

I will definitely give it a shot and come back at you...!

Thanks,
Jade