frank850102
New Member
- Joined
- Jan 26, 2010
- Messages
- 7
Hi all
I have an excel workbook, which has 6 worksheets. For one of the worksheets, I want to adjust the print area according to the value of a cell. I wrote a macro code to do this as below:
Sub Changeprintarea()
If Range("N84").Value <> "" Then<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
PrintArea = "$B$1:$M$87"
ElseIf Range("N84").Value = "" Then<o></o>
PrintArea = "$B$1:$M$121"<o></o>
End If<o></o>
End Sub
This code works Ok, but the problem is I have to click the button every time to make the code run!
Is there a way to make the code run automatically based on the value of the cell ("N84") without clicking button?
Please help
<o></o>
I have an excel workbook, which has 6 worksheets. For one of the worksheets, I want to adjust the print area according to the value of a cell. I wrote a macro code to do this as below:
Sub Changeprintarea()
If Range("N84").Value <> "" Then<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
PrintArea = "$B$1:$M$87"
ElseIf Range("N84").Value = "" Then<o></o>
PrintArea = "$B$1:$M$121"<o></o>
End If<o></o>
End Sub
This code works Ok, but the problem is I have to click the button every time to make the code run!
Is there a way to make the code run automatically based on the value of the cell ("N84") without clicking button?
Please help
<o></o>