Creato da: fumarinox il 08/11/2005
osservazioni su fenomeni naturali

Area personale

 

Archivio messaggi

 
 << Ottobre 2024 >> 
 
LuMaMeGiVeSaDo
 
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
 
 

Cerca in questo Blog

  Trova
 

FACEBOOK

 
 

I miei Blog Amici

Citazioni nei Blog Amici: 7
 

Ultime visite al Blog

prefazione09Ninfea_candidaahmad785paolo_cdromanticoBOLOGNAlucirobertoCandido84monellaccio19f.tizymuciaciom12ps12Domi_tgiselar_1980fumarinoxstregattodistratto
 

Chi può scrivere sul blog

Solo l'autore può pubblicare messaggi in questo Blog e tutti gli utenti registrati possono pubblicare commenti.
 
RSS (Really simple syndication) Feed Atom
 
 

 

 
« gestione caratteri letteralis.rosario a Lourdes »

gestione monomi e trinomi

Post n°905 pubblicato il 09 Luglio 2010 da fumarinox
 

gestione monomi e trinomi con VBA su Excel
http://digilander.libero.it/francescovise/vbacodice/prova13.htm
http://digilander.libero.it/francescovise/vbacodice/prova13.xls
http://digilander.libero.it/francescovise/vbacodice/prova13.GIF

 

Private Sub CommandButton1_Click()
Rem esercitazione per gestione stringa
Rem notare che se manca segno + nella stringa
Rem viene conteggiato automaticamente
Rem esempio stringa 125abc risulta lunga 6 ma valore 125 lungo non 3 ma 4

Dim nv, nt As Integer
Rem inserire segno + o -
nt = 0
nv = 0
's = "+125abc"
's="125abc"
s = "+123ab456xyz"
ls = Len(s)
vs = Val(s)
sv = Str$(vs)
lv = Len(sv)
sr = Right(s, (ls - lv))
lsr = Len(sr)
sv2 = Mid$(sr, 3, 3)
ss2 = Left(sr, 2)
ss3 = Right(sr, 3)

Cells(1, 1) = "stringa s"
Cells(2, 1) = "lunghezza ls"
Cells(3, 1) = "valore vs"
Cells(4, 1) = "stringa valore sv"
Cells(5, 1) = "lunghezza stringa valore lv"
Cells(6, 1) = "stringa residua sr"
Cells(7, 1) = "lunghezza stringa residua lsr"
Cells(8, 1) = "numero cifre residue nv"
Cells(9, 1) = "numero caratteri residui nt"
Cells(10, 1) = "stringa numerica interna sv2"
Cells(11, 1) = "stringa iniziale ss2"
Cells(12, 1) = "stringa finale ss3"


Cells(1, 3) = "ricerca cifre e caratteri in residua"
For a = 1 To lsr
ca = Mid$(sr, a, 1)
If IsNumeric(ca) Then
nv = nv + 1
Else
nt = nt + 1
End If
Cells(a, 5) = ca
Next a

Cells(1, 2) = s
Cells(2, 2) = ls
Cells(3, 2) = vs
Cells(4, 2) = sv
Cells(5, 2) = lv
Cells(6, 2) = sr
Cells(7, 2) = lsr
Cells(8, 2) = nv
Cells(9, 2) = nt

Cells(10, 2) = sv2
Cells(11, 2) = ss2
Cells(12, 2) = ss3

End Sub

Private Sub CommandButton2_Click()
For riga = 1 To 13
For colonna = 1 To 6
Cells(riga, colonna) = ""
Next colonna
Next riga
End Sub

Private Sub CommandButton3_Click()
Rem esercitazione per gestione stringa

Dim nv, nt As Integer
Rem inserire segno + o -
nt = 0
nv = 0
s = "-123dfab45676xyz"
ls = Len(s)
vs = Val(s)
sv = Str$(vs)
lv = Len(sv)
sr = Right(s, (ls - lv))
lsr = Len(sr)
sv2 = Mid$(sr, 5, 5)
ss2 = Left(sr, 4)
ss3 = Right(sr, 3)

Cells(1, 1) = "stringa s"
Cells(2, 1) = "lunghezza ls"
Cells(3, 1) = "valore vs"
Cells(4, 1) = "stringa valore sv"
Cells(5, 1) = "lunghezza stringa valore lv"
Cells(6, 1) = "stringa residua sr"
Cells(7, 1) = "lunghezza stringa residua lsr"
Cells(8, 1) = "numero cifre residue nv"
Cells(9, 1) = "numero caratteri residui nt"
Cells(10, 1) = "stringa numerica interna sv2"
Cells(11, 1) = "stringa iniziale ss2"
Cells(12, 1) = "stringa finale ss3"


Cells(1, 3) = "ricerca cifre e caratteri in residua"
For a = 1 To lsr
ca = Mid$(sr, a, 1)
If IsNumeric(ca) Then
nv = nv + 1
Else
nt = nt + 1
End If
Cells(a, 5) = ca
Next a

Cells(1, 2) = s
Cells(2, 2) = ls
Cells(3, 2) = vs
Cells(4, 2) = sv
Cells(5, 2) = lv
Cells(6, 2) = sr
Cells(7, 2) = lsr
Cells(8, 2) = nv
Cells(9, 2) = nt

Cells(10, 2) = sv2
Cells(11, 2) = ss2
Cells(12, 2) = ss3

End Sub

 
Condividi e segnala Condividi e segnala - permalink - Segnala abuso
 
 
Vai alla Home Page del blog

© Italiaonline S.p.A. 2024Direzione e coordinamento di Libero Acquisition S.á r.l.P. IVA 03970540963