VBA

LarryGeorge

New Member
Joined
Jan 9, 2020
Messages
32
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
I'm trying to make a device loaner check out and check back in.

My "check out" code is below

I'm not sure how to get the "check in" process to work.

To check the device back in, I want it take the information deviceassetnumber.Value and to look in column A.
If device is found anywhere in column A turn the specific G column cell to .Interior.ColorIndex = 4


Check out code is as follows:


Private Sub CommandButton1_Click()

Dim LastRow As Long, ws As Worksheet

Set ws = Sheets("High School")

LastRow = ws.Range("A" & Rows.Count).End(xlUp).Row + 1 'Finds the last blank row

ws.Range("A" & LastRow).Value = deviceassetnumber.Value
ws.Range("B" & LastRow).Value = firstname.Value
ws.Range("C" & LastRow).Value = lastname.Value
ws.Range("D" & LastRow).Value = Format(Date, "MM/DD/YYYY")
ws.Range("E" & LastRow).Value = Format(Now, "HH:MM Am/Pm")
ws.Range("F" & LastRow).Value = ComboBox1.Value
ws.Range("G" & LastRow).Interior.ColorIndex = 3

MsgBox "Asset Tag Number : " & deviceassetnumber.Value & vbNewLine & vbNewLine & "Device : " & ComboBox1.Value & vbNewLine & vbNewLine & "First Name : " & firstname.Value & vbNewLine & vbNewLine & "Last Name : " & lastname.Value & vbNewLine & vbNewLine & "Date : " & Format(Date, "MM/DD/YYYY") & vbNewLine & vbNewLine & "Time : " & Format(Now, "HH:MM Am/Pm")

deviceassetnumber.Value = ""
firstname.Value = ""
lastname.Value = ""
ComboBox1.Value = ""
checkoutscreen.Hide
MainScreen.Show

End Sub
 
I overlooked another way using the Red / Green status in Column G for the filter but whatever, I have very busy schedule but will see if can find some time to have a play

Dave
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

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