🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.vbasic
Article #104201

Re: zimenna typu date w tabeli

#104201
From: Dominik
Date: Mon, 29 Jun 2009 11:15
66 lines
2709 bytes
On Jun 29, 6:19 am, Jacek <a...@ola.pl> wrote:
> Ten kod w kolumnie B wstawi ">1" w przypadku, gdy wartosc w A wystepuje
> wiecej niz 1 raz:
>
> Sub qq()
> x = 1
> z = 0
> While Cells(x, 1) <> ""
>   y = 1
>   While Cells(y, 1) <> ""
>     If x <> y Then
>       If Cells(x, 1) = Cells(y, 1) Then Cells(x, 2) = ">1"
>     End If
>     y = y + 1
>   Wend
>   x = x + 1
> Wend
> End Sub

Witam,

Dzieki za podpowiedzi, mam teraz cos takiego  i wreszcie dziala:

Sub give_day_arr()

Dim qday() As Variant
Dim item As Variant
Dim i As Integer 'liczy elementy tabeli
Dim x As Integer 'wewnetrzna petla sprawdza czy wartosc komorki juz
sie pojawila
Dim a As Integer 'numer wiersza

a = 1
i = 1
Cells(a, 1).Activate

Do While Cells(a, 1).Value <> ""
    ReDim Preserve qday(i)
    qday(i) = Cells(a, 1).Value
    For x = 1 To i - 1
        If qday(i) = qday(x) Then
            i = i - 1
            Exit For
        End If
    Next x
    i = i + 1
    a = a + 1
Loop

i = i - 1
ReDim Preserve qday(i)

For Each item In qday
   Debug.Print item
Next

End Sub

Problemy byly dwa:
1. w przypadku nieposortowanej kolumny usuwalo zbyt wiele elementow
(dlatego umiescilem wczesniejsze wyjscie po pierwszym usunieciu).
2. dublowalo ostatni element tabeli jesli byl dwa (lub wiecej razy) na
liscie. ReDim Preserve na samym koncu zalatwilo sprawe.

Jeszcze raz dziekuje za pomoc,
Dominik
Technical Details
Message-ID: <0cbdcebc-7157-42e5-88aa-cc13057e2b25@a7g2000yqk.googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!postnews.google.com!a7g2000yqk.googlegroups.com!not-for-mail
References: <a75e2721-78da-4433-a11a-7c48f1082905@g20g2000vba.googlegroups.com> <h1t3gm$hee$1@inews.gazeta.pl> <d93ff76f-0fad-4b52-9739-00b8f25bade5@l12g2000yqo.googlegroups.com> <v8pw74yf9qsz$.vw894rph43iu.dlg@40tude.net>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!postnews.google.com!a7g2000yqk.googlegroups.com!not-for-mail
From: Dominik <dominik.hemzaczek@gmail.com>
Newsgroups: pl.comp.lang.vbasic
Subject: Re: zimenna typu date w tabeli
Date: Mon, 29 Jun 2009 04:15:14 -0700 (PDT)
Organization: http://groups.google.com
Lines: 66
Message-ID: <0cbdcebc-7157-42e5-88aa-cc13057e2b25@a7g2000yqk.googlegroups.com>
References: <a75e2721-78da-4433-a11a-7c48f1082905@g20g2000vba.googlegroups.com>  <h1t3gm$hee$1@inews.gazeta.pl> <d93ff76f-0fad-4b52-9739-00b8f25bade5@l12g2000yqo.googlegroups.com>  <v8pw74yf9qsz$.vw894rph43iu.dlg@40tude.net>
NNTP-Posting-Host: 94.125.16.11
Mime-Version: 1.0
X-Trace: posting.google.com 1246274115 6438 127.0.0.1 (29 Jun 2009 11:15:15 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 29 Jun 2009 11:15:15 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: a7g2000yqk.googlegroups.com; posting-host=94.125.16.11;  posting-account=u_pyjwoAAADk69QJkz3JFD6TeLXvOWDj
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;  SV1),gzip(gfe),gzip(gfe)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit