by userform Find Date and add row contains price with same formatting and put to adjacent ID under date

leap out

Active Member
Joined
Dec 4, 2020
Messages
288
Office Version
  1. 2016
  2. 2010
Hi
I want when add ID in textbox1 and price in textbox2 then should add new row with the same formatting and put the price under date(today)
here is data
ite.JPG



form
IT2.JPG



result(see in row18)
IT3.JPG


but if the ID is existed like this
IT4.JPG


then result(see row12) without add new row just add price under date because the id is existed)
IT5.JPG

last thing when add new row should add zero as hyphen empty cells
here is simple code and I would fix it , adapting
VBA Code:
Private Sub CommandButton1_Click()
    Dim findDate As Date 
    Dim findStr As String
    Dim ws As Worksheet, R As Range ,lr As Long
    Set ws = Sheets("PRICES")
  findStr = Format(findDate, "YYYY/MM/DD")
    Set R = ws.Rows(1).Find(what:=findStr, LookIn:=xlValues, lookat:=xlWhole)
   LR = ws.Cells(Rows.Count, 2).End(3).Row
   Range("C" & LR + 1) = TextBox1.Value
  R.Offst(,1).Value=Textbox2.Text
End Sub
thanks
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

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