Forum » Programiranje » Excel Macro
Excel Macro
gorjanc ::
V excelu imam takle stolpec:
(gor_27272727)
(gor_[807])
(gor_[821])
(gor_[824])
(gor_[836])
(gor_[684])
(gor_[833])
(gor_[867])
(gor_[888])
(gor_930)
(gor_845)
(gor_[964])
(gor_977)
(gor_985)
(gor_1105)
gor_ (gor_)
gor_1002 (gor_1002)
gor_1011 (gor_1011)
gor_1013 (gor_1013)
gor_1017 (gor_1017)
gor_1018 (gor_1018)
gor_1022 (gor_1022)
gor_1029 (gor_1029)
Iz stolpca potrebujem dobiti ven samo številke v vrsticah kjer je številka podvojena je potrebno eno izbrisati. Kakšen pameten predlog kako naj se lotim zadeve?
(gor_27272727)
(gor_[807])
(gor_[821])
(gor_[824])
(gor_[836])
(gor_[684])
(gor_[833])
(gor_[867])
(gor_[888])
(gor_930)
(gor_845)
(gor_[964])
(gor_977)
(gor_985)
(gor_1105)
gor_ (gor_)
gor_1002 (gor_1002)
gor_1011 (gor_1011)
gor_1013 (gor_1013)
gor_1017 (gor_1017)
gor_1018 (gor_1018)
gor_1022 (gor_1022)
gor_1029 (gor_1029)
Iz stolpca potrebujem dobiti ven samo številke v vrsticah kjer je številka podvojena je potrebno eno izbrisati. Kakšen pameten predlog kako naj se lotim zadeve?
StratOS ::
No nekaj na hitro Makrič v VB :
Izberi si količino podatkov v vrsticah (23) ter kam ti podatke izpiše stolpec 3
Izberi si količino podatkov v vrsticah (23) ter kam ti podatke izpiše stolpec 3
Sub Macro1() Dim N As Integer Dim M As Integer Dim M1 As Integer Dim Str As String Dim Char As String Dim Najdeno As Boolean Dim Start As Integer Dim Konec As Integer For N = 1 To 23 'Recimo 23 Str = Cells(N, 1) M = Len(Str) M1 = 1 Najdeno = False Loop1: Char = Mid$(Str, M1, 1) If Asc(Char) >= 48 And Asc(Char) <= 57 Then If Najdeno = False Then Najdeno = True: Start = M1 Else If Najdeno = True Then Najdeno = False: Konec = M1: GoTo jump End If If Najdeno = False Then Konec = M1 If M1 >= M Then GoTo jump M1 = M1 + 1 GoTo Loop1 jump: 'Rezultate pišemo v stolpec 3 If Start = 1 And Konec = M Then Cells(N, 3) = "" 'Prazno Else Cells(N, 3) = Mid$(Str, Start, Konec - Start) End If Konec = 1: Start = 1 Najdeno = False Next N End Sub
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"The one who is digging the hole for the other to fall in is allready in it."
"It works better if you plug it in."
"The one who is digging the hole for the other to fall in is allready in it."
StratOS ::
Dobro, da smo takoj zadeli v polno :)
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"The one who is digging the hole for the other to fall in is allready in it."
"It works better if you plug it in."
"The one who is digging the hole for the other to fall in is allready in it."
mgoza ::
kaj pa takole [8-)]
Public Function NajdiPrvoCeloStevilo(z) As String ' ' funkcija vrne prvo stevilo, ki ga najde v zapisu ' Dim zNak As String ' posamesen znak v zapisu Dim zaPis As String ' zapis v katerem iscem celo stevilo Dim i As Long ' pozicija znaka, ki ga preverjam ' ' nastavim zacetne vrednosti ' zaPis = Trim(z & "") NajdiPrvoCeloStevilo = "" ' ' iscem v zapisih daljsih od 0 znakov ' If Len(zaPis) > 0 Then For i = 1 To Len(zaPis) zNak = Mid(zaPis, i, 1) If IsNumeric(zNak) Then ' ce je tekoci znak stevilo ga pripisen iskanemu nizu NajdiPrvoCeloStevilo = NajdiPrvoCeloStevilo & zNak Else ' ce tekoci znak ni stevilo, nasel pa sem ze stevilo zapustim zanko If IsNumeric(NajdiPrvoCeloStevilo) Then Exit For End If Next 'i End If End Function
Zgodovina sprememb…
- spremenil: mgoza ()
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | visual basic 2008 express editionOddelek: Programiranje | 1816 (1243) | sel |
» | Visual basic noob questionOddelek: Programiranje | 1564 (1319) | DonMatejo |
» | [excel]duplikatiOddelek: Programiranje | 1477 (1404) | baksuz |
» | [Excel] problem z makrojem, visual basic (strani: 1 2 )Oddelek: Programiranje | 5669 (5132) | steev |
» | kopiranje iz enega fajla v drug??Oddelek: Programiranje | 1219 (979) | Seth |