🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Makro - przesuń wiersze - problem:(

#104491
From: nothing.at.all
Date: Fri, 26 Feb 2010 11:33
64 lines
2587 bytes
Napisałam sobie makro, które przesuwa mi wiersze, to znaczy gdy mam w Excelu 
jakiś link z adresem bezwzględnym, to klikając na makro zostanie ten adres 
linku przesunięty o tyle wierszy ile mu podam. I coś niestety nie działa:(
Proszę o zerknięcie i pomoc. I z góry dziękuję.

Sub PrzesunWiersze()

Dim Liczba As String
Dim Cyfra As Integer
Dim Znak As Integer
Dim Nliczba As Integer
Dim NowaFormula As String
Dim Zakres As Range
Dim Zmiana


Zmiana = InputBox("Podaj przesunięcie wierszy")
If Zmiana = "" Then Exit Sub
' ustala zakres do zmian
Set Zakres = Selection

For Each Cell In Zakres
Cell.Activate

' zamiana cyfer w jednej komórce
For Znak = 1 To Len(ActiveCell.Formula)

' dodaje znak jeśli nie numeryczny
If IsNumeric(Right(Left(ActiveCell.Formula, Znak), 1)) = False Then
NowaFormula = NowaFormula & Right(Left(ActiveCell.Formula, Znak), 1)

'modyfikuje i dodaje znaki jeśli liczbowe
     If IsNumeric(Right(Left(ActiveCell.Formula, Znak), 1)) = True Then
       If Right(Left(ActiveCell.Formula, Znak - 1), 1) = "$" Then

           Cyfra = 0
           Do Until IsNumeric(Right(Left(ActiveCell.Formula, Znak + 
Cyfra),1)) = False Or Znak + Cyfra - 1 = Len(ActiveCell.Formula)
               Liczba = Liczba & Right(Left(ActiveCell.Formula, Znak +Cyfra), 
1)
               Cyfra = Cyfra + 1
           Loop
           Nliczba = CInt(Liczba) + Zmiana
           NowaFormula = NowaFormula & Nliczba
           Liczba = ""
           Znak = Znak + Cyfra - 1

       Else
           NowaFormula = NowaFormula & Right(Left(ActiveCell.Formula,
Znak), 1)
       End If
    End If

Next Znak


ActiveCell.Formula = NowaFormula
NowaFormula = ""
Next Cell
End Sub


-- 
Wysłano z serwisu Usenet w portalu Gazeta.pl -> http://www.gazeta.pl/usenet/
Technical Details
Message-ID: <hm8bj5$q4o$1@inews.gazeta.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
From: " nothing.at.all" <nothing.at.all@WYTNIJ.gazeta.pl>
Newsgroups: pl.comp.lang.vbasic
Subject: Makro - przesuń wiersze - problem:(
Date: Fri, 26 Feb 2010 11:33:58 +0000 (UTC)
Organization: "Portal Gazeta.pl -> http://www.gazeta.pl"
Lines: 64
Message-ID: <hm8bj5$q4o$1@inews.gazeta.pl>
NNTP-Posting-Host: localhost
X-Trace: inews.gazeta.pl 1267184038 26776 172.20.26.241 (26 Feb 2010 11:33:58 GMT)
X-Complaints-To: usenet@agora.pl
NNTP-Posting-Date: Fri, 26 Feb 2010 11:33:58 +0000 (UTC)
X-User: nothing.at.all
X-Forwarded-For: 212.2.96.100
X-Remote-IP: localhost
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit