Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default First result doesn't show up - drives me crazy


Hi guys,

I've got some VBA script here and it does the job perfectly but there
is one problem : the first result doesn't show up in the output ! The
result of the script should look like item 1, item 2, item 3 but I
always get item2, item3

Please help me ... I can't seem to find the problem !

Here is the vba code :


Dim cell As Range, rng As Range
Dim s As String
Dim c As Integer, i As Integer, a As Integer

With Worksheets("Mechanismen volgens object")
Set rng = .Range(.Cells(16, 1), .Cells(Rows.Count, 1).End(xlUp))
End With

c = 5
i = 9
a = 13

For Each cell In rng
If cell.Offset(0, 1).Value = "x" Then 'And _'
'cell.Offset(0, c).Value + cell.Offset(0, i).Value +
cell.Offset(0, a).Value "0" Then'
s = testing & s & cell.Value & Chr(10)
End If
Next

Worksheets("O - NW").Range("I4").Value = s



--
floep
------------------------------------------------------------------------
floep's Profile: http://www.excelforum.com/member.php...o&userid=36853
View this thread: http://www.excelforum.com/showthread...hreadid=565970

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 415
Default First result doesn't show up - drives me crazy

I would it not meet your criteria of:
If cell.Offset(0, 1).Value = "x" Then

NickHK

"floep" ¼¶¼g©ó¶l¥ó·s»D:floep.2bnp62_1154091607.065@excelfo rum-nospam.com...

Hi guys,

I've got some VBA script here and it does the job perfectly but there
is one problem : the first result doesn't show up in the output ! The
result of the script should look like item 1, item 2, item 3 but I
always get item2, item3

Please help me ... I can't seem to find the problem !

Here is the vba code :


Dim cell As Range, rng As Range
Dim s As String
Dim c As Integer, i As Integer, a As Integer

With Worksheets("Mechanismen volgens object")
Set rng = .Range(.Cells(16, 1), .Cells(Rows.Count, 1).End(xlUp))
End With

c = 5
i = 9
a = 13

For Each cell In rng
If cell.Offset(0, 1).Value = "x" Then 'And _'
'cell.Offset(0, c).Value + cell.Offset(0, i).Value +
cell.Offset(0, a).Value "0" Then'
s = testing & s & cell.Value & Chr(10)
End If
Next

Worksheets("O - NW").Range("I4").Value = s



--
floep
------------------------------------------------------------------------
floep's Profile:
http://www.excelforum.com/member.php...o&userid=36853
View this thread: http://www.excelforum.com/showthread...hreadid=565970



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default First result doesn't show up - drives me crazy


I solved the problem fo the first result. My range was to narro
defined. I changed it and now I get an error on countc.


With Worksheets("Mechanismen volgens object")
Set rng = .Range(.Cells(2, 1), .Cells(Rows.Count, 1).End(xlUp))
End With

For Each cell In rng
countc = cell.Offset(0, 5).Value
If cell.Offset(0, 2).Value = "x" Then
s = s & cell.Value & Chr(10)
End If
Next



--
floe
-----------------------------------------------------------------------
floep's Profile: http://www.excelforum.com/member.php...fo&userid=3685
View this thread: http://www.excelforum.com/showthread.php?threadid=56597

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default First result doesn't show up - drives me crazy

Is Item 1 in row 16 or greater?

--
Regards,
Tom Ogilvy


"floep" wrote:


Hi guys,

I've got some VBA script here and it does the job perfectly but there
is one problem : the first result doesn't show up in the output ! The
result of the script should look like item 1, item 2, item 3 but I
always get item2, item3

Please help me ... I can't seem to find the problem !

Here is the vba code :


Dim cell As Range, rng As Range
Dim s As String
Dim c As Integer, i As Integer, a As Integer

With Worksheets("Mechanismen volgens object")
Set rng = .Range(.Cells(16, 1), .Cells(Rows.Count, 1).End(xlUp))
End With

c = 5
i = 9
a = 13

For Each cell In rng
If cell.Offset(0, 1).Value = "x" Then 'And _'
'cell.Offset(0, c).Value + cell.Offset(0, i).Value +
cell.Offset(0, a).Value "0" Then'
s = testing & s & cell.Value & Chr(10)
End If
Next

Worksheets("O - NW").Range("I4").Value = s



--
floep
------------------------------------------------------------------------
floep's Profile: http://www.excelforum.com/member.php...o&userid=36853
View this thread: http://www.excelforum.com/showthread...hreadid=565970


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default First result doesn't show up - drives me crazy


Hi Tom,

The items are in column 1, the types in columns 2 till 5 and the
properties in columns 6 till 16. I tried to crack the problem with the
code below but now it gives me an error on 'cell.Offset(0, 5).Value +
cell.Offset(0, 9).Value + cell.Offset(0, 13).Value' when I try to run
the code. If I don't do the extra filtering (the filtering after the
and _) the code runs fine. It's like the offsets are out of range.
There is also always an extra empty line in the output. Thanks for your
help ...


Dim cell As Range, rng As Range
Dim s As String

With Worksheets("Mechanismen volgens object")
Set rng = .Range(.Cells(2, 1), .Cells(Rows.Count, 1).End(xlUp))
End With

For Each cell In rng
If cell.Offset(0, 1).Value = "x" and _
cell.Offset(0, 5).Value + cell.Offset(0, 9).Value +
cell.Offset(0, 13).Value "0" Then
s = s & cell.Value & Chr(10)
End If
Next



--
floep
------------------------------------------------------------------------
floep's Profile: http://www.excelforum.com/member.php...o&userid=36853
View this thread: http://www.excelforum.com/showthread...hreadid=565970



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default First result doesn't show up - drives me crazy


Hi Tom,

Item 1 is in row 2 instead of 16 ... that was my mistake :-)

Floep


--
floep
------------------------------------------------------------------------
floep's Profile: http://www.excelforum.com/member.php...o&userid=36853
View this thread: http://www.excelforum.com/showthread...hreadid=565970

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
Show result of a SUM in a VLOOKUP Sarah (OGI) Excel Worksheet Functions 5 March 23rd 07 05:50 PM
show result in msg box Jared Excel Discussion (Misc queries) 4 October 8th 06 09:03 PM
Why does the formula show instead of the result? carpfish Excel Discussion (Misc queries) 3 July 5th 06 08:10 PM
Advanced formula - Return result & Show Cell Reference of result Irv Excel Worksheet Functions 7 May 6th 06 03:36 AM
Show only Matrix result emel24 Excel Worksheet Functions 3 February 16th 05 04:49 PM


All times are GMT +1. The time now is 01:26 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"