Number/Text Issues

S

Shane

I have a workbook "Case Prep File" that holds this macro. Before running, I
open a second workbook "Client List". I am trying to run (using a
commandbutton) a macro that takes information from "Client List" and feeds it
into a Userform. The information that I enter into the Input Box should
match one (or more) numbers in "Client List", Column A.

As I test this macro (while stepping through it) I see that GIDInput value
is the number I enter, but TMIS.Range("groupid").value is the same number
with quotations around it. I thought that using "@" in the code will make
them of the format, but I think that isn't working correctly.

Help, please! (It runs through the whole list without ever entering the IF
statement, so I don't even know if that code works right either, so if you
see issues there, please help me out there too)
 
S

Shane

Here is the code..

Sub CommandButton5_Click()

Dim LastRow As Long
Dim GIDCell As Range, TMISCell As Range
Dim TMIS As Worksheet, CList As Worksheet
Dim Option1Label As MSForms.Label, Option2Label As MSForms.Label,
Option3Label
Dim GIDInput, GID, FN1, FN2, FN3, FN4, LN1, LN2, LN3, LN4, GIDCount, GIDRow
Set TMIS = ThisWorkbook.Sheets("Team Member Input Sheet")
Set CList = Workbooks("Client List.xls").Sheets(1)
Set GID = ThisWorkbook.Sheets("Team Member Input Sheet").Range("groupid")
Application.ScreenUpdating = False
Application.EnableEvents = False
LastRow = CList.Range("A" & Rows.Count).End(xlUp).Row
GIDInput = InputBox("What is the 11 digit GROUP ID (No Check Digit) of the
clients you are looking up?", "Client Search")
TMIS.Range("groupid").Value = GIDInput
TMIS.Range("groupid").NumberFormat = "@"
CList.Activate
Columns("A:A").NumberFormat = "@"
On Error GoTo ws_exit
GIDCount = 1
Load ClientSelForm
For Each GIDCell In CList.Range("A1", "A" & LastRow)
If GIDCell.Value = TMIS.Range("groupid").Value Then
If Range("D" & GIDCell.Row).Value = "" Then
TMIS.Range("FName" & GIDCount).Value = CList.Range("C" &
GIDCell.Row).Value
Else: TMIS.Range("FName" & GIDCount).Value = CList.Range("D" &
GIDCell.Row).Value
End If
TMIS.Range("LName" & GIDCount).Value = CList.Range("E" &
GIDCell.Row).Value
ClientSelForm.Controls("Option" & GIDCount & "Label").Caption =
Range("FName" & GIDCount).Value & " " & Range("LNname" & GIDCount).Value
End If
GIDCount = GIDCount + 1
Next GIDCell
ClientSelForm.Show
ws_exit:
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top