Help in updating 2nd work sheet form user form

mmikem

New Member
Joined
Mar 29, 2018
Messages
4
Hello All
I have a user form that I use to update memberships But what I need to do is update the member date on a 2nd work sheet
it would have to find the members name from the cboMem and use the dtpMdate the second sheet is called MemNum and has a name range called listMemberNum

Here is what I use to write to the first sheet I am new to VBA any suggestions Thanks :)

Code:
Private Sub cmdEnter_Click()
    mMem = Me.cboMem
    mOrha = Me.txtOrha
    mNrha = Me.txtNrha
    mOef = Me.txtOef
    mAddress = txtaddress
    mProv = cboProv
    mPost = txtPost
    mhome = txtHome
    mPCell = txtPCell
    mEmail = txtEmail
    mMg = cboMg
    mMt = cboMt
    mLyy = txtLyy
    mDollars = txtDollars
    mPtype = cboPtype
    mChecknum = txtChecknum
On Error Resume Next
Set mCell = ActiveCell
    With mCell
        .Value = mMem
        .Offset(0, 1) = dtpMDate
        .Offset(0, 22) = NewMem
        .Offset(0, 2) = mOrha
        .Offset(0, 3) = mNrha
        .Offset(0, 4) = mOef
        .Offset(0, 5) = mAddress
        .Offset(0, 6) = mProv
        .Offset(0, 7) = mPost
        .Offset(0, 9) = mhome
        .Offset(0, 10) = mPCell
        .Offset(0, 12) = mEmail
        .Offset(0, 13) = mMg
        .Offset(0, 14) = mMt
        .Offset(0, 15) = mLyy
        .Offset(0, 23) = mDollars
        .Offset(0, 26) = mPtype
        .Offset(0, 27) = mChecknum
        .Offset(0, 51) = CheckBox1
        .Offset(0, 52) = CheckBox2
        .Offset(0, 53) = CheckBox3
        .Offset(0, 54) = CheckBox4
        .Offset(0, 55) = CheckBox5
        .Offset(0, 56) = CheckBox6
        .Offset(0, 57) = CheckBox7
      
     End With
   
            Unload Me
    
End Sub
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Looks like you need to figure out the address of mCell which I assume mean "matched cell"
Something like this perhaps.
Code:
if iserror(application.match(mMem,cbMem,0))=false then
mCell = cells(application.match(mMem,cboMem,0), "static column letter of cboMem?").address
endif
 
Upvote 0
No the code I listed works fine and writes all the info to sheet 1

What I want to do is add to that code If the name in cboMem is found on sheet 2 the date from dptMdate is written to sheet 2 in the column beside the name
 
Upvote 0
Which column on sheet 2 contains the names? And I suppose they are unique?
If so my code is almost correct.

Code:
if iserror(application.match(cboMem, column-range-on-sheet2,0))=false then
hitrow = application.match(cboMem, column-range-on-sheet2,0)
sheet2.cells(hitrow, date-column-range-on-sheet2) = dptMdate
endif
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

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