Simpatie.ro - matrimoniale
Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Nou pe simpatie:
Profil CriStiNutZa..
Femeie
24 ani
Bucuresti
cauta Barbat
26 - 80 ani
Mrrrr's Forum (VIEW ONLY)ReguliInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides /

[EXCEL] Move, remove, replace etc strings (eg. minus) [VBA, formula]

Pagini: 1 Moderat de TRaP, TonyTzu
#1
TRaP
Moderator
Postari: 960

Sub MOVEcharacter()
    Dim key As String
    Dim c As Range
    Application.ScreenUpdating = False

    key = "-"
   
With ActiveSheet
    Set c = Selection
       
For rw = 1 To c.Rows.Count
    For col = 1 To c.Columns.Count
'    If IsNumeric(InStr(c(rw, col).Value, key)) And InStr(c(rw, col), key) > 0 Then
    If Right(c(rw, col).Value, 1) = key And InStr(c(rw, col), key) > 0 Then
        c(rw, col).Value = Left(c(rw, col).Value, InStr(c(rw, col).Value, key) - 1)
    On Error GoTo 0
        c(rw, col).Value = key & c(rw, col).Value
        c(rw, col).Value = c(rw, col).Value
    End If
   
    Next
Next
End With

Application.ScreenUpdating = True
End Sub


Source:
https://www.ozgrid.com/forum/forum/help ... ht-of-text


 
   
#2
TRaP
Moderator
Postari: 960
More:
http://www.globaliconnect.com/excel/ind ... Itemid=475


 
   
#3
Mrrrr
AdMiN
Postari: 2388
This will move the minus sign from the end of a number 50- to the beginning -50:


Sub FixNumbers()
  [A:A].TextToColumns Destination:=[A1], DataType:=xlDelimited, TrailingMinusNumbers:=True
End Sub


Source:
https://www.computing.net/answers/offic ... 21297.html


_______________________________________


 
   
#4
TRaP
Moderator
Postari: 960
Title updated to include the word "minus" to make it easier to find

 
   
#5
TRaP
Moderator
Postari: 960

Mrrrr a scris:

This will move the minus sign from the end of a number 50- to the beginning -50:

Sub FixNumbers()
....


This formula will also work, so you don't necessarily need VBA:

=IFERROR(TEXTBEFORE(A2;"-")*-1;A2)


Source:
https://www.youtube.com/watch?v=fanzm-5TdRk


 
   
Pagini: 1  
Mergi la