srivardhan kandike
srivardhan kandike

Reputation: 25

How to a Add text to Range

What I have:

Range("A" & i+1).value=Range("B" & i).value

What I Need:

"'" & Range("A" & i+1).value=Range("B" & i).value

The output I Need:

'1234

How do I add that type of text using VBA I'm trying to implement with other functions but it is giving me an error

Upvotes: 0

Views: 393

Answers (2)

Vityata
Vityata

Reputation: 43565

If you need to format given cell as a text, then this is a working solution:

Sub TestMe()
    Range("A1").NumberFormat = "@"
    Range("A1") = 1234
End Sub

Upvotes: 0

BigBen
BigBen

Reputation: 49998

You've got the order mixed up:

Range("A" & i+1).value = "'" & Range("B" & i).value

Upvotes: 2

Related Questions