#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Finding row

The following works as it is written, but I can not figure out how to get
check the value in the column to the left of the find.
something like

Set x = Offset(0,1). Range("sales" & CD).Find(CP)

But everything I have tried has returned an error.

Function Checkpost(CP As Date, CD As String)
Dim x

With Worksheets("sales " & CD)
Set x = Range("sales" & CD).Find(CP)
End With

If x Is Nothing Then
Checkpost = True
Else
Checkpost = False
End If
End Function


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Finding row

x.offset(0,-1) should work. Put this into the ELSE part of the if statement.

"treasuresflemar" wrote:

The following works as it is written, but I can not figure out how to get
check the value in the column to the left of the find.
something like

Set x = Offset(0,1). Range("sales" & CD).Find(CP)

But everything I have tried has returned an error.

Function Checkpost(CP As Date, CD As String)
Dim x

With Worksheets("sales " & CD)
Set x = Range("sales" & CD).Find(CP)
End With

If x Is Nothing Then
Checkpost = True
Else
Checkpost = False
End If
End Function



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Finding row

Set x = Range("sales" & CD).Find(CP).offset(0,-1)


"treasuresflemar" skrev:

The following works as it is written, but I can not figure out how to get
check the value in the column to the left of the find.
something like

Set x = Offset(0,1). Range("sales" & CD).Find(CP)

But everything I have tried has returned an error.

Function Checkpost(CP As Date, CD As String)
Dim x

With Worksheets("sales " & CD)
Set x = Range("sales" & CD).Find(CP)
End With

If x Is Nothing Then
Checkpost = True
Else
Checkpost = False
End If
End Function



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Finding row

You also need to check if the cellis in column A,otherwise, you could get an
error.

"treasuresflemar" wrote:

The following works as it is written, but I can not figure out how to get
check the value in the column to the left of the find.
something like

Set x = Offset(0,1). Range("sales" & CD).Find(CP)

But everything I have tried has returned an error.

Function Checkpost(CP As Date, CD As String)
Dim x

With Worksheets("sales " & CD)
Set x = Range("sales" & CD).Find(CP)
End With

If x Is Nothing Then
Checkpost = True
Else
Checkpost = False
End If
End Function



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Finding row

Sorry, I explained that all wrong.
CP will always be found in column "A"
There will always be only one occurrence of CP in the range.
It will always be found.
Need to see if the sum of columns "B" through "L" in the row CP is
found in 0
if so then checkpost = false
What I need x to do is return the row number and I can handle the rest, I
think.

Thanks Carl


Function Checkpost(CP As Date, CD As String)
'CP is the date that is being posted
'CD is the Year being posted which is part
'of the named range
'Checkpost returns True if no posting has been made
'to the posting date

Dim x


With Worksheets("sales " & CD)
'sets the sheet the data is on for the year invloved
Set x = Range("sales" & CD).Find(CP).Offset(0, 1)


Set x = Range("sales" & CD).Find(CP)
'selects the correct range
End With

If x Is Nothing Then
Checkpost = True
'Nothing posted to that day

Else
Checkpost = False
'A posting to that date has been done
End If
End Function


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
Finding second value? bgkgmg Excel Worksheet Functions 6 August 24th 08 05:22 PM
Finding the last one [email protected] Excel Programming 5 September 20th 07 10:28 PM
finding a tab name tigoda Excel Programming 2 May 14th 07 02:49 PM
finding the last value Simon Shaw Excel Discussion (Misc queries) 8 January 16th 05 10:02 AM
vba..finding first non-zero value in a row Andrew Appel Excel Programming 3 October 20th 03 05:33 AM


All times are GMT +1. The time now is 03:06 AM.

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"