Simple add on to macro?

ppleasebob

Board Regular
Joined
Dec 23, 2002
Messages
145
I have used the following code, as provided on this board for someone else,

Sub Job_Number()

Dim Startcell As Range

' The fist job number cell
Set Startcell = Range("A10")

If IsEmpty(Startcell) Then
' First Job number
Startcell = 1
Else
' Next job number
With Cells(Rows.Count, Startcell.Column).End(xlUp)
.Offset(1).Value = .Value + 1

End With
End If

End Sub

Can you suggest how I then copy the number that was generated above and paste it into Cell D5 on sheet named "Main"


Thanks for your assistance in advance

bob
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
I have used the following code, as provided on this board for someone else,

Sub Job_Number()

Dim Startcell As Range

' The fist job number cell
Set Startcell = Range("A10")

If IsEmpty(Startcell) Then
' First Job number
Startcell = 1
Else
' Next job number
With Cells(Rows.Count, Startcell.Column).End(xlUp)
.Offset(1).Value = .Value + 1

End With
End If

End Sub

Can you suggest how I then copy the number that was generated above and paste it into Cell D5 on sheet named "Main"


Thanks for your assistance in advance

bob

Maybe this line after End if:

Sheets("Main").Range("D5").Value = ActiveSheet.Cells(Rows.Count, Startcell.Column).End(xlUp).Offset(1).Value + 1
 
Upvote 0
John,

Thanks for this however it doesn't quite do it, the second time you run the macro, it still returns the value of 1 rather than 2

Any ideas?
 
Upvote 0

Forum statistics

Threads
1,214,629
Messages
6,120,630
Members
448,973
Latest member
ChristineC

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top