Need advice on coding for a logic statement in a macro

DThib

Active Member
Joined
Mar 19, 2010
Messages
464
Office Version
  1. 365
Platform
  1. Windows
1 other thing I am playing with, I am trying to choose the row with the latest data for a userform that displays the information.
The ID for the item may be duplicated from a different day, so I need to make the selection only pull the current data defined by a date in row A.


any ideas?
 

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
Another thing, this is in a logic statement before the userform adds the data to the form.

I cannot get the verbiage right.

DThib
 
Upvote 0
1 other thing I am playing with, I am trying to choose the row with the latest data for a userform that displays the information.
The ID for the item may be duplicated from a different day, so I need to make the selection only pull the current data defined by a date in row A.


any ideas?

Hi,
to find the row containing latest date in column A you could try incorporation following in your code & see if helps you

Code:
With Worksheets("Sheet1")


MsgBox Application.Match(Application.Max(.Columns(1)), .Columns(1), 0)


End With

change sheet name as required

Dave
 
Last edited:
Upvote 0
Thanks. I used the DATE function and it is comparing now, but the rest of my code to fill in the information on the userform with that line of data for the current date is blank.
I think I am missing a command.
Here is the code:

Code:
Dim WoWg As Worksheet
  Dim WGo As String
  Dim WGoW As Range
   On Error GoTo Rats




     SPR_W = Work_FRM.SPR_IDTB.Value
     Set WoWg = Sheets("Workable")


     Set WGoW = WoWg.Columns("B").Find(SPR_W, LookIn:=xlValues, LookAt:=xlWhole)
[COLOR=#b22222][U]    If SPR_W <> "" And WoWg.Cells(WGoW.Row, 1).Value = Date Then[/U][/COLOR]
        WoWg.Activate


        WorkingRow = WorksheetFunction.CountA(Range("A:A"))
         Wprod_TB.Value = WoWg.Cells(WGoW.Row, 6).Value
         Wdaysw_TB.Value = WoWg.Cells(WGoW.Row, 12).Value
         WSum_TB.Value = WoWg.Cells(WGoW.Row, 7).Value
         Wsever_TB.Value = WoWg.Cells(WGoW.Row, 8).Value
         Wassign_TB.Value = WoWg.Cells(WGoW.Row, 3).Value
         Wserialn_TB.Value = WoWg.Cells(WGoW.Row, 9).Value
         Wdayso_TB.Value = WoWg.Cells(WGoW.Row, 13).Value


    Else
       MsgBox "Add Number", vbCritical + vbOKOnly, "Here we go..."
    End If
    Call Wister
Rats:
 MsgBox "Information Missing", vbExclamation + vbOKOnly, "Error with SPR ID Information"


End Sub

Before adding the And for the date, it would fill out the data on the userform.
 
Last edited:
Upvote 0
I keep trying to add the information from the current date's row and get nothing and then the comment box info gets placed in the wrong date row and overwrites current data.

I need help fast, please.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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