VBA - Trying To Give User MessageBox Showing Month-Year For InputBox Data Entry

DR RENO

Board Regular
Joined
Jun 29, 2018
Messages
65
Still trying to learn VBA and reached a stumbling block as I'm trying to build out a Mark to Market report. I have a 3rd party source that gives pricing which I'm wanting the user to enter into spreadsheet via input box. I have code that will allow them to just put in values going down the column, but would like to have code that reads the Contract Month dates that appear for Market Zone 'A'. Example: There are contract months associated with A for : Jan-2019; Apr-2019; May-2019). Message box will prompt what period's price they should enter.

Also, my code currently is displaying values going down and continues on down each time a new mark is entered. Is there a way to have a daily entry coded, with entry date as a header, that will start fresh values the next time you press the Enter Marks command button?

Any help/tips a VBA pro could give me would immensely appreciated.

Dropbox Link: https://www.dropbox.com/s/xkm34h2bhpzfxxb/Dashboard (1).xlsm?dl=0

Current Code:
Code:
Private Sub CommandButton8_Click()

Dim lngLstRow&
Dim strMyIPBMsg$
 strMyIPBMsg = InputBox("Add Rates:", "Need Rate!")
With Sheets("Shuttle Marks")
 lngLstRow = .UsedRange.Rows.Count + .UsedRange.Row
 .Range("A" & lngLstRow).Value = strMyIPBMsg
End With
 Sheets("Shuttle Marks").Select
End Sub
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Still trying to learn VBA and reached a stumbling block as I'm trying to build out a Mark to Market report. I have a 3rd party source that gives pricing which I'm wanting the user to enter into spreadsheet via input box. I have code that will allow them to just put in values going down the column, but would like to have code that reads the Contract Month dates that appear for Market Zone 'A'. Example: There are contract months associated with A for : Jan-2019; Apr-2019; May-2019). Message box will prompt what period's price they should enter.

Also, my code currently is displaying values going down and continues on down each time a new mark is entered. Is there a way to have a daily entry coded, with entry date as a header, that will start fresh values the next time you press the Enter Marks command button?

Any help/tips a VBA pro could give me would immensely appreciated.

Dropbox Link: https://www.dropbox.com/s/xkm34h2bhpzfxxb/Dashboard (1).xlsm?dl=0

Current Code:
Code:
Private Sub CommandButton8_Click()

Dim lngLstRow&
Dim strMyIPBMsg$
 strMyIPBMsg = InputBox("Add Rates:", "Need Rate!")
With Sheets("Shuttle Marks")
 lngLstRow = .UsedRange.Rows.Count + .UsedRange.Row
 .Range("A" & lngLstRow).Value = strMyIPBMsg
End With
 Sheets("Shuttle Marks").Select
End Sub

Is there anyone who can give me assistance?
 
Upvote 0
I've tried to get the two inputboxes to coordinate with messagebox, but still having trouble. Anyone spot what's wrong with my code? Seriously needing help from an expert.

Code:
Private Sub CommandButton8_Click()Dim Dte As Date
Dim lngLstRow&
Dim strMyIPBMsg$


mbox = InputBox("Enter Contract Month", "Need Date")
With Sheets("Shuttle Marks")
If IsDate(mbox) Then
Dte = CDate(mbox)
Range("A" & lngLstRow) = Dte
Else
MsgBox "Not accepted date"
End If


strMyIPBMsg = InputBox("Add Rates:", "Need Rate!")


With Sheets("Shuttle Marks")
 lngLstRow = .UsedRange.Rows.Count + .UsedRange.Row
 .Range("B" & lngLstRow).Value = strMyIPBMsg
  Sheets("Shuttle Marks").Select
End With




 
End Sub
 
Upvote 0
Is there anyone who can give me assistance?

I'm getting closer, as I'm getting the message box to prompt and capture my date and price, but it's not starting on A2 and B2 like I need it to. Also it will not allow you to continue entering data. Any help you can provide would be appreciated.

Code:
[/COLOR]Private Sub CommandButton8_Click()Dim Dte As Date
Dim lngLstRow&
Dim strMyIPBMsg$


mbox = InputBox("Enter Contract Month", "Need Date")
With Sheets("Shuttle Marks")
If IsDate(mbox) Then
Dte = CDate(mbox)


.Range("A2" & lngLstRow).Value = Dte
Else
MsgBox "Not accepted date"


End If


strMyIPBMsg = InputBox("Add Rates:", "Need Rate!")




 lngLstRow = .UsedRange.Rows.Count + .UsedRange.Row
 .Range("B" & lngLstRow).Value = strMyIPBMsg


End With
  Sheets("Shuttle Marks").Select


 

End Sub[COLOR=#333333]
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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