Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Code using A sheet to find a number

Can someone help please
I would like for it to look at sheet2 and see if "V014989" Is in the column
A Row 2:65535



Private Sub StoreAccountNumbers()
On Error Resume Next
With ActiveSheet
If .Range("B3").Value = "V014989" Then
.Name = "101_" & Format(Now(), "[$-409]yyyymmdd;@")

ElseIf .Range("B3").Value = "V014990" Then
.Name = "102_" & Format(Now(), "[$-409]yyyymmdd;@")
End If
End With
With ActiveSheet
If .Range("B3").Value = "V014991" Then
.Name = "103_" & Format(Now(), "[$-409]yyyymmdd;@")
ElseIf .Range("B3").Value "V014991" Then
.Name = "Unknown_" & Format(Now(), "[$-409]yyyymmdd;@")
End If
If Err.Number < 0 Then
MsgBox Err.Number & " -- " & Err.Description
End If
On Error GoTo 0
End With
'PromptForSave
'SaveWorkbookToFolder
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Code using A sheet to find a number

What you have now is looking for one instance of the value in cell b3. This
would be much easier with a select case statement. My question is:
Are you looking for all three of these? And, are there more than one
instance? Maybe you want.

Sub findem()
myarray = Array("a", "b", "c")
For Each c In myarray
x = Columns(4).Find(c)
Select Case UCase(x)
Case "A": y = 1
Case "B": y = 2
Case "C": y = 3
Case Else
End Select
MsgBox y
Next
End Sub


--
Don Guillett
SalesAid Software

"Mike" wrote in message
...
Can someone help please
I would like for it to look at sheet2 and see if "V014989" Is in the
column
A Row 2:65535



Private Sub StoreAccountNumbers()
On Error Resume Next
With ActiveSheet
If .Range("B3").Value = "V014989" Then
.Name = "101_" & Format(Now(), "[$-409]yyyymmdd;@")

ElseIf .Range("B3").Value = "V014990" Then
.Name = "102_" & Format(Now(), "[$-409]yyyymmdd;@")
End If
End With
With ActiveSheet
If .Range("B3").Value = "V014991" Then
.Name = "103_" & Format(Now(), "[$-409]yyyymmdd;@")
ElseIf .Range("B3").Value "V014991" Then
.Name = "Unknown_" & Format(Now(), "[$-409]yyyymmdd;@")
End If
If Err.Number < 0 Then
MsgBox Err.Number & " -- " & Err.Description
End If
On Error GoTo 0
End With
'PromptForSave
'SaveWorkbookToFolder
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Code using A sheet to find a number

Its looking on sheet1 B3
would like to see if sheet1 B3 Value is on sheet2 A3:A65535 and if it is then
use the Value in Column B next to the match

"Don Guillett" wrote:

What you have now is looking for one instance of the value in cell b3. This
would be much easier with a select case statement. My question is:
Are you looking for all three of these? And, are there more than one
instance? Maybe you want.

Sub findem()
myarray = Array("a", "b", "c")
For Each c In myarray
x = Columns(4).Find(c)
Select Case UCase(x)
Case "A": y = 1
Case "B": y = 2
Case "C": y = 3
Case Else
End Select
MsgBox y
Next
End Sub


--
Don Guillett
SalesAid Software

"Mike" wrote in message
...
Can someone help please
I would like for it to look at sheet2 and see if "V014989" Is in the
column
A Row 2:65535



Private Sub StoreAccountNumbers()
On Error Resume Next
With ActiveSheet
If .Range("B3").Value = "V014989" Then
.Name = "101_" & Format(Now(), "[$-409]yyyymmdd;@")

ElseIf .Range("B3").Value = "V014990" Then
.Name = "102_" & Format(Now(), "[$-409]yyyymmdd;@")
End If
End With
With ActiveSheet
If .Range("B3").Value = "V014991" Then
.Name = "103_" & Format(Now(), "[$-409]yyyymmdd;@")
ElseIf .Range("B3").Value "V014991" Then
.Name = "Unknown_" & Format(Now(), "[$-409]yyyymmdd;@")
End If
If Err.Number < 0 Then
MsgBox Err.Number & " -- " & Err.Description
End If
On Error GoTo 0
End With
'PromptForSave
'SaveWorkbookToFolder
End Sub




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Code using A sheet to find a number

OK. Now, Is there MORE than one instance of the value to look for. Or, Just
ONE....

--
Don Guillett
SalesAid Software

"Mike" wrote in message
...
Its looking on sheet1 B3
would like to see if sheet1 B3 Value is on sheet2 A3:A65535 and if it is
then
use the Value in Column B next to the match

"Don Guillett" wrote:

What you have now is looking for one instance of the value in cell b3.
This
would be much easier with a select case statement. My question is:
Are you looking for all three of these? And, are there more than one
instance? Maybe you want.

Sub findem()
myarray = Array("a", "b", "c")
For Each c In myarray
x = Columns(4).Find(c)
Select Case UCase(x)
Case "A": y = 1
Case "B": y = 2
Case "C": y = 3
Case Else
End Select
MsgBox y
Next
End Sub


--
Don Guillett
SalesAid Software

"Mike" wrote in message
...
Can someone help please
I would like for it to look at sheet2 and see if "V014989" Is in the
column
A Row 2:65535



Private Sub StoreAccountNumbers()
On Error Resume Next
With ActiveSheet
If .Range("B3").Value = "V014989" Then
.Name = "101_" & Format(Now(), "[$-409]yyyymmdd;@")

ElseIf .Range("B3").Value = "V014990" Then
.Name = "102_" & Format(Now(), "[$-409]yyyymmdd;@")
End If
End With
With ActiveSheet
If .Range("B3").Value = "V014991" Then
.Name = "103_" & Format(Now(), "[$-409]yyyymmdd;@")
ElseIf .Range("B3").Value "V014991" Then
.Name = "Unknown_" & Format(Now(), "[$-409]yyyymmdd;@")
End If
If Err.Number < 0 Then
MsgBox Err.Number & " -- " & Err.Description
End If
On Error GoTo 0
End With
'PromptForSave
'SaveWorkbookToFolder
End Sub






  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Code using A sheet to find a number

No Just one instance of the Value


"Don Guillett" wrote:

OK. Now, Is there MORE than one instance of the value to look for. Or, Just
ONE....

--
Don Guillett
SalesAid Software

"Mike" wrote in message
...
Its looking on sheet1 B3
would like to see if sheet1 B3 Value is on sheet2 A3:A65535 and if it is
then
use the Value in Column B next to the match

"Don Guillett" wrote:

What you have now is looking for one instance of the value in cell b3.
This
would be much easier with a select case statement. My question is:
Are you looking for all three of these? And, are there more than one
instance? Maybe you want.

Sub findem()
myarray = Array("a", "b", "c")
For Each c In myarray
x = Columns(4).Find(c)
Select Case UCase(x)
Case "A": y = 1
Case "B": y = 2
Case "C": y = 3
Case Else
End Select
MsgBox y
Next
End Sub


--
Don Guillett
SalesAid Software

"Mike" wrote in message
...
Can someone help please
I would like for it to look at sheet2 and see if "V014989" Is in the
column
A Row 2:65535



Private Sub StoreAccountNumbers()
On Error Resume Next
With ActiveSheet
If .Range("B3").Value = "V014989" Then
.Name = "101_" & Format(Now(), "[$-409]yyyymmdd;@")

ElseIf .Range("B3").Value = "V014990" Then
.Name = "102_" & Format(Now(), "[$-409]yyyymmdd;@")
End If
End With
With ActiveSheet
If .Range("B3").Value = "V014991" Then
.Name = "103_" & Format(Now(), "[$-409]yyyymmdd;@")
ElseIf .Range("B3").Value "V014991" Then
.Name = "Unknown_" & Format(Now(), "[$-409]yyyymmdd;@")
End If
If Err.Number < 0 Then
MsgBox Err.Number & " -- " & Err.Description
End If
On Error GoTo 0
End With
'PromptForSave
'SaveWorkbookToFolder
End Sub








  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Code using A sheet to find a number

If, as I understand it, you are trying to match the value in cell b3 to a
cell on sheet2 in col A and use the value in the next column, then it seems
to me that a simple vlookup FORMULA would do this for you without code. Or,
am I still not understanding?

=vlookup(sheet1!b3,sheet2!a3:b1000,2,0)

--
Don Guillett
SalesAid Software

"Mike" wrote in message
...
No Just one instance of the Value


"Don Guillett" wrote:

OK. Now, Is there MORE than one instance of the value to look for. Or,
Just
ONE....

--
Don Guillett
SalesAid Software

"Mike" wrote in message
...
Its looking on sheet1 B3
would like to see if sheet1 B3 Value is on sheet2 A3:A65535 and if it
is
then
use the Value in Column B next to the match

"Don Guillett" wrote:

What you have now is looking for one instance of the value in cell b3.
This
would be much easier with a select case statement. My question is:
Are you looking for all three of these? And, are there more than one
instance? Maybe you want.

Sub findem()
myarray = Array("a", "b", "c")
For Each c In myarray
x = Columns(4).Find(c)
Select Case UCase(x)
Case "A": y = 1
Case "B": y = 2
Case "C": y = 3
Case Else
End Select
MsgBox y
Next
End Sub


--
Don Guillett
SalesAid Software

"Mike" wrote in message
...
Can someone help please
I would like for it to look at sheet2 and see if "V014989" Is in the
column
A Row 2:65535



Private Sub StoreAccountNumbers()
On Error Resume Next
With ActiveSheet
If .Range("B3").Value = "V014989" Then
.Name = "101_" & Format(Now(), "[$-409]yyyymmdd;@")

ElseIf .Range("B3").Value = "V014990" Then
.Name = "102_" & Format(Now(), "[$-409]yyyymmdd;@")
End If
End With
With ActiveSheet
If .Range("B3").Value = "V014991" Then
.Name = "103_" & Format(Now(), "[$-409]yyyymmdd;@")
ElseIf .Range("B3").Value "V014991" Then
.Name = "Unknown_" & Format(Now(), "[$-409]yyyymmdd;@")
End If
If Err.Number < 0 Then
MsgBox Err.Number & " -- " & Err.Description
End If
On Error GoTo 0
End With
'PromptForSave
'SaveWorkbookToFolder
End Sub








  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Code using A sheet to find a number

That will work but I would like it to be in code instead.

"Don Guillett" wrote:

If, as I understand it, you are trying to match the value in cell b3 to a
cell on sheet2 in col A and use the value in the next column, then it seems
to me that a simple vlookup FORMULA would do this for you without code. Or,
am I still not understanding?

=vlookup(sheet1!b3,sheet2!a3:b1000,2,0)

--
Don Guillett
SalesAid Software

"Mike" wrote in message
...
No Just one instance of the Value


"Don Guillett" wrote:

OK. Now, Is there MORE than one instance of the value to look for. Or,
Just
ONE....

--
Don Guillett
SalesAid Software

"Mike" wrote in message
...
Its looking on sheet1 B3
would like to see if sheet1 B3 Value is on sheet2 A3:A65535 and if it
is
then
use the Value in Column B next to the match

"Don Guillett" wrote:

What you have now is looking for one instance of the value in cell b3.
This
would be much easier with a select case statement. My question is:
Are you looking for all three of these? And, are there more than one
instance? Maybe you want.

Sub findem()
myarray = Array("a", "b", "c")
For Each c In myarray
x = Columns(4).Find(c)
Select Case UCase(x)
Case "A": y = 1
Case "B": y = 2
Case "C": y = 3
Case Else
End Select
MsgBox y
Next
End Sub


--
Don Guillett
SalesAid Software

"Mike" wrote in message
...
Can someone help please
I would like for it to look at sheet2 and see if "V014989" Is in the
column
A Row 2:65535



Private Sub StoreAccountNumbers()
On Error Resume Next
With ActiveSheet
If .Range("B3").Value = "V014989" Then
.Name = "101_" & Format(Now(), "[$-409]yyyymmdd;@")

ElseIf .Range("B3").Value = "V014990" Then
.Name = "102_" & Format(Now(), "[$-409]yyyymmdd;@")
End If
End With
With ActiveSheet
If .Range("B3").Value = "V014991" Then
.Name = "103_" & Format(Now(), "[$-409]yyyymmdd;@")
ElseIf .Range("B3").Value "V014991" Then
.Name = "Unknown_" & Format(Now(), "[$-409]yyyymmdd;@")
End If
If Err.Number < 0 Then
MsgBox Err.Number & " -- " & Err.Description
End If
On Error GoTo 0
End With
'PromptForSave
'SaveWorkbookToFolder
End Sub









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
VB code to copy sheet format to another sheet ASU Excel Discussion (Misc queries) 12 August 10th 06 03:37 AM
Why code for find() is not working jesmin Excel Discussion (Misc queries) 1 December 28th 05 09:43 PM
to find number of days between 2 dates using vba code in excel sjayar Excel Discussion (Misc queries) 3 November 3rd 05 07:24 AM
how do i create an access code sheet to number my office files an. dana New Users to Excel 1 February 12th 05 04:49 AM
Find all text instances in a sheet and add one number from each row Greg Excel Discussion (Misc queries) 1 February 1st 05 12:45 AM


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

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

About Us

"It's about Microsoft Excel"