input box cancel button
I am using an input box to get a value for changing the axis on every
chart in a worksheet. I works fine but when cancel is hit I get a strange result. how can Improve the code below so a cancel hit will return to the worksheet with no change Sub set_axis() Dim ch As ChartObject mindepth = Application.InputBox(prompt:="Please Enter The Top Depth for the Plot") maxdpeth = mindpeth + 60 For Each ch In ActiveSheet.ChartObjects With ch.Chart.Axes(xlValue) .MinimumScale = mindepth .MaximumScale = mindepth + 60 .ReversePlotOrder = True .CrossesAt = mindepth End With Next ActiveSheet.Name = "Core Plot " & mindepth & "m" End Sub Cheers Ian |
input box cancel button
Ian,
One way If Len(mindepth) 0 then * your code * End If This works even if something is entered into the input box. -- sb "Ian Mangelsdorf" wrote in message om... I am using an input box to get a value for changing the axis on every chart in a worksheet. I works fine but when cancel is hit I get a strange result. how can Improve the code below so a cancel hit will return to the worksheet with no change Sub set_axis() Dim ch As ChartObject mindepth = Application.InputBox(prompt:="Please Enter The Top Depth for the Plot") maxdpeth = mindpeth + 60 For Each ch In ActiveSheet.ChartObjects With ch.Chart.Axes(xlValue) .MinimumScale = mindepth .MaximumScale = mindepth + 60 .ReversePlotOrder = True .CrossesAt = mindepth End With Next ActiveSheet.Name = "Core Plot " & mindepth & "m" End Sub Cheers Ian |
All times are GMT +1. The time now is 02:43 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com