ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding A Date Command Button (https://www.excelbanter.com/excel-programming/347867-adding-date-command-button.html)

hazey

Adding A Date Command Button
 

Hey there. Here is what I would like to do. I am using Excel 2000.
would like to add a command button to my Excel form that, when pressed
will add 56 days to a cell on my spread sheet. I'm sure this is rathe
simple for you guys, but I really have no clue and it would be a hug
help for me if you could send me the code. Thanks so much in advance

--
haze
-----------------------------------------------------------------------
hazey's Profile: http://www.excelforum.com/member.php...fo&userid=2956
View this thread: http://www.excelforum.com/showthread.php?threadid=49263


Rowan Drummond[_3_]

Adding A Date Command Button
 
Try:

Private Sub cmdAddDays_Click()
With Sheets("Sheet1").Range("A1")
If IsDate(.Value) Then
.Value = .Value + 56
End If
End With
End Sub

Hope this helps
Rowan

hazey wrote:
Hey there. Here is what I would like to do. I am using Excel 2000. I
would like to add a command button to my Excel form that, when pressed,
will add 56 days to a cell on my spread sheet. I'm sure this is rather
simple for you guys, but I really have no clue and it would be a huge
help for me if you could send me the code. Thanks so much in advance.



Leith Ross[_373_]

Adding A Date Command Button
 

Hello Hazy,

Here is a code example using A1 as the cell with the date of Oct, 15
2005. The result of adding 56 days will yield Dec 10, 2005.

CODE EXAMPLE:

With Worksheets("Sheet1")
Range("A1").Value = .Range("A1").Value + 56
End With

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=492633


hazey[_2_]

Adding A Date Command Button
 

Awesome, thanks a lot you guys! Works perfectly!


--
hazey
------------------------------------------------------------------------
hazey's Profile: http://www.excelforum.com/member.php...o&userid=29561
View this thread: http://www.excelforum.com/showthread...hreadid=492633


Rowan Drummond[_3_]

Adding A Date Command Button
 
You're welcome.

hazey wrote:
Awesome, thanks a lot you guys! Works perfectly!




All times are GMT +1. The time now is 09:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com