🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Przenoszenie tekstu o różnych kolorach pomiędzy komórkami tabeli

#105006
From: Paweł
Date: Fri, 17 Apr 2015 15:16
42 lines
2306 bytes
Tak w ramach ciekawości zrobiłem sobie takie zadanie na arkuszu Excela. Na 
Wordzie też powinno działać, po zmianie indeksów komórek (wiersz, kolumna). 
Działa to tak jak opisałeś. Na początku makro tworzy "n" komórek, a potem 
przenosi i kasuje wiersze:
-------------------------------------------------------------
Sub komorki()
  Dim a, i, n As Integer
  i = 1
  a = 1
  n = 20
  For i = 1 To n Step 1
    Cells(i, 1).Value = a
    a = a + 1
  Next i
  For i = 1 To n Step 2
    Cells(i, 1).Interior.ColorIndex = 4
  Next i
  i = 2
  For i = 2 To n Step 2
    Cells(i, 1).Interior.ColorIndex = 6
  Next i
  For i = 2 To n Step 2
    Cells(i, 1).Select
    Selection.Copy
    Cells(i - 1, 2).Select 'gdzie ma być skopiowane
    ActiveSheet.Paste 'Wklejasz
  Next i
  i = 1
  For i = 1 To n Step 1
    Cells(i, 1).Interior.ColorIndex = 4
    Cells(i, 2).Interior.ColorIndex = 6
  Next i
  For i = 2 To n   'usuwanie pustego wiersza
   If (Cells(i, 2).Value = "") Then
     Rows(i).Delete
   End If
  Next i
End Sub
------------------------------------------------------------

Pozdrawiam
Paweł 
Technical Details
Message-ID: <553123b1$0$2203$65785112@news.neostrada.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!goblin1!goblin.stu.neva.ru!newsfeed.neostrada.pl!unt-exc-02.news.neostrada.pl!unt-spo-a-02.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
References: <d5b3ee04-55c4-4c87-9867-f24ff0b1621d@googlegroups.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!goblin1!goblin.stu.neva.ru!newsfeed.neostrada.pl!unt-exc-02.news.neostrada.pl!unt-spo-a-02.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
From: Paweł <brop@wp.pl>
Newsgroups: pl.comp.lang.vbasic
References: <d5b3ee04-55c4-4c87-9867-f24ff0b1621d@googlegroups.com>
In-Reply-To: <d5b3ee04-55c4-4c87-9867-f24ff0b1621d@googlegroups.com>
Subject: Re: Przenoszenie tekstu o różnych kolorach
 pomiędzy komórkami tabeli
Date: Fri, 17 Apr 2015 17:16:00 +0200
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Newsreader: Microsoft Windows Live Mail 15.4.3508.1109
X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3508.1109
Lines: 43
Message-ID: <553123b1$0$2203$65785112@news.neostrada.pl>
Organization: Telekomunikacja Polska
NNTP-Posting-Host: 83.29.171.133
X-Trace: 1429283761 unt-rea-a-01.news.neostrada.pl 2203 83.29.171.133:20711
X-Complaints-To: abuse@news.neostrada.pl
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit