#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Adding 1

Hi
here's the scenario.......
Default number = 06/0241 ....
i have a userform (US1) with a button (CMD1), upon executing CMD1 ColumnA
cellA1 in the worksheet must be selected and a number inserted i.e. 06/0241 +
1. thiss cell should now display 06/0242, upon 2nd execution of CMD cellA2
should display 06/0243 etc...
is this posible to be done usin code....
Please assist

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default Adding 1

something like the below might work:

'=====================================
Private Sub CMD1_Click()

Dim myRow As Integer
myRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row

If Range("A1") = "" Then
Range("A1") = "06/0242"
Else
Cells(myRow + 1, 1) = "06/024" & myRow + 2
End If

End Sub
=====================================

Rgds
J


On Oct 18, 1:46 pm, Zaahir wrote:
Hi
here's the scenario.......
Default number = 06/0241 ....
i have a userform (US1) with a button (CMD1), upon executing CMD1 ColumnA
cellA1 in the worksheet must be selected and a number inserted i.e. 06/0241 +
1. thiss cell should now display 06/0242, upon 2nd execution of CMD cellA2
should display 06/0243 etc...
is this posible to be done usin code....
Please assist


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Adding 1

Function incr2nd(celltoinc As Range)
parts = Split(celltoinc, "/")
incr2nd = parts(0) & "/" & Format(parts(1) + 1, "0000")
End Function

Sub test()
x = incr2nd(ActiveCell)
End Sub

Regards,
Stefi

Zaahir ezt *rta:

Hi
here's the scenario.......
Default number = 06/0241 ....
i have a userform (US1) with a button (CMD1), upon executing CMD1 ColumnA
cellA1 in the worksheet must be selected and a number inserted i.e. 06/0241 +
1. thiss cell should now display 06/0242, upon 2nd execution of CMD cellA2
should display 06/0243 etc...
is this posible to be done usin code....
Please assist

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding using IF? yimkhoc Excel Discussion (Misc queries) 2 August 11th 08 07:21 PM
Help with adding 10% Jennifer Excel Worksheet Functions 2 January 31st 07 08:56 PM
Adding every 5th row (e.g. B5 + B10 + B15 etc) Shazzer Excel Discussion (Misc queries) 6 December 20th 06 08:00 PM
Adding Up! ExcelBob Excel Discussion (Misc queries) 2 June 14th 06 02:31 PM
Adding with & Jim Excel Worksheet Functions 3 February 4th 05 03:30 AM


All times are GMT +1. The time now is 03:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"