Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Group,
I am working on a project that selects 2 values and looks for those 3 values in another sheet. My question is how can i make it add the variable found ones the two criteria are met. (code is below) Thanks in advance, Fish Dim fsheet As String Dim rng As Range Dim val As String Dim val1 As String Do ActiveCell.Offset(1, 0).Select val = ActiveCell.Offset(0, -12).Value With Workbooks(fnameb).Worksheets(fsheet) Set rng = .Columns(3).Find(val) End With If Not rng Is Nothing Then val1 = rng.Offset(0, 11).Value |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim val2 as double
dim val1 as double Dim val as long Dim fsheet as string Dim fnameb as string Dim rng1 as Range Dim rng2 as Range Do ActiveCell.Offset(1, 0).Select val = ActiveCell.Offset(0, -12).Value Val1=Activecell.offset(0,11).value With Workbooks(fnameb).Worksheets(fsheet) Set rng1 = .Columns(3).Find(val) Set rng2 = .Columns(2).Find(val1) End With If Not rng1 Is Nothing Then if Not rng2 is nothing then ' both val and val1 were found else ' only val was found end if elseif not rng2 is nothing then '. only val1 was found else ' neither was found End if I don't know what you want to do in each case - so you would need to add that. -- Regards, Tom Ogilvy "Fish" wrote in message ... Group, I am working on a project that selects 2 values and looks for those 3 values in another sheet. My question is how can i make it add the variable found ones the two criteria are met. (code is below) Thanks in advance, Fish Dim fsheet As String Dim rng As Range Dim val As String Dim val1 As String Do ActiveCell.Offset(1, 0).Select val = ActiveCell.Offset(0, -12).Value With Workbooks(fnameb).Worksheets(fsheet) Set rng = .Columns(3).Find(val) End With If Not rng Is Nothing Then val1 = rng.Offset(0, 11).Value |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Not at all clear on use of variables and/or object variables | Excel Discussion (Misc queries) | |||
More than 1 Variables | Excel Discussion (Misc queries) | |||
Three Variables | Excel Worksheet Functions | |||
Using variables . . . | Excel Discussion (Misc queries) | |||
Too many variables? | Excel Worksheet Functions |