Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default returning values

Hi, i am trying to modify this code so that it would be able to return values
which are not only excact matches but also values that contain the first 4
digits of the number eg at the moment if i want to find job numbers 2685,
2685-1, 2685-2 i have to do three seperate searches , however is it possible
to be able enter 2685 and have all relevant entries appear as well such as
2685-1, 2685-2
This is the current code i am using

Case 3: ' find by job number

From_Date = InputBox("Enter start date") ' Asks user to enter first
comparison date
To_Date = InputBox("Enter end date")
Job_No = InputBox("Enter Job Number")


Daily_Row_Index = 153 ' Re assign start position for Rowindex
Cells(151, 243).Value = From_Date ' Transfers date into correct
Cell($ii$151)
Cells(151, 245).Value = To_Date ' Transfers date into correct
Cell($ii$151)
Row_Index = 3 ' Row index




Today = Cells(Row_Index, date_col).Value
Main_Job_No = Cells(Row_Index, Job_Col).Value

Do While Today < "": ' Loop if there is an entry in the date column

If Today To_Date Then Exit Do ' If Main Data Date Column is greater then
end date Exit program otherwise step in

If Today = From_Date Then 'Still looping until we get a match with dates
and carryon past here but step in


If Job_No = Main_Job_No Then ' Found Match dates, Transfers Main Data into
Franklin Sheet


Cells(Daily_Row_Index, Daily_Date).Value = Cells(Row_Index, date_col).Value
Cells(Daily_Row_Index, Daily_Operator).Value =
Cells(Row_Index, Operator_Col).Value
Cells(Daily_Row_Index, Daily_Job).Value = Cells(Row_Index,
Job_Col).Value
Cells(Daily_Row_Index, Daily_Location).Value =
Cells(Row_Index, Location_Col).Value
Cells(Daily_Row_Index, Daily_Daysheet).Value =
Cells(Row_Index, Daysheet_Col).Value
Cells(Daily_Row_Index, Daily_Left).Value = Cells(Row_Index,
Left_Col).Value
Cells(Daily_Row_Index, Daily_Centre).Value =
Cells(Row_Index, Centre_Col).Value
Cells(Daily_Row_Index, Daily_Right).Value = Cells(Row_Index,
Right_Col).Value
Cells(Daily_Row_Index, Daily_Min_Paint).Value =
Cells(Row_Index, Min_Paint_Col).Value
Cells(Daily_Row_Index, Daily_Width).Value = Cells(Row_Index,
Width_Col).Value
Cells(Daily_Row_Index, Daily_Colour).Value =
Cells(Row_Index, Colour_Col).Value
Cells(Daily_Row_Index, Daily_Result).Value =
Cells(Row_Index, Result_Col).Value
Cells(Daily_Row_Index, Daily_Tester).Value =
Cells(Row_Index, Tester_Col).Value
Count_Entries = Count_Entries + 1

Daily_Row_Index = Daily_Row_Index + 1 ' Increment Sheet to
next row for new data
End If
End If

Row_Index = Row_Index + 1 ' Increment Main Data Row
Today = Cells(Row_Index, date_col).Value ' Transfer new date into
Today Variable for new comparison
Main_Job_No = Cells(Row_Index, Job_Col).Value ' Transfer new Job
Number into Main_Job_No variable few new comparison
If Count_Entries = 43 Then
MsgBox "Sorry too many entries"
Exit Do
End If
Loop
MsgBox ("All relevant entries entered into Daily Sheet")
MsgBox (Job_No & " has been used " & Count_Entries & " times between " &
From_Date & " and " & To_Date)

Thanks to anyone who takes the time to read this.
Cheers
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default returning values



If Job_No = Main_Job_No Then ' Found Match dates, Transfers Main Data
into Franklin Sheet


If Job_No Like Main_Job_No & "*" Then


--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sumif using Values, but returning text or values Jose Excel Discussion (Misc queries) 1 April 14th 10 09:01 PM
Returning Values Harlan Excel Discussion (Misc queries) 1 December 12th 06 10:19 PM
Returning Values Troy2006 Excel Discussion (Misc queries) 5 July 31st 06 07:44 PM
Returning a sum when looking up two different values 1stcoast Excel Worksheet Functions 1 April 17th 06 02:45 PM
returning values enna84 Excel Programming 0 August 12th 04 08:36 AM


All times are GMT +1. The time now is 07:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"