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.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
deiutza20
Femeie
21 ani
Bacau
cauta Barbat
21 - 44 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] Move, remove, replace etc strings (eg. minus) [VBA, formula] Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739

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:

Modificat de TRaP (acum 5 ani)


pus acum 5 ani
   
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739
More:

pus acum 5 ani
   
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2186
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:


_______________________________________


pus acum 5 ani
   
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739
Title updated to include the word "minus" to make it easier to find

pus acum 3 ani
   
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739

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:


pus acum 3 luni
   
Pagini: 1  

Mergi la