[Solved] is it possible to select a range in Excel using VBA and put a value like text or some formulas?


I’m not even sure I understand what you’re asking.

select a value in excel and put some text or formula

So you want to search for something than replace that with something else? (text/formula).

Or just if it’s possible to change a Cells value?

Start with the easier, change a Cells value or add a formula

Set ws = ThisWorkbook.Worksheets(1)

'Set A1's Value to 12
ws.Cells("A1").Value = "12"

'Insert formula to show today's date
ws.Cells("A2").Formula = "=TEXT(NOW(),""yyyy.mm.dd"")"

For the other possibility

Copied from MSDN’s Range.FindNext Method (Excel)

With Worksheets(1).Range("a1:a500") 
    Set c = .Find(2, lookin:=xlValues) 
    If Not c Is Nothing Then 
        firstAddress = c.Address 
        Do 
            c.Value = 5 
            Set c = .FindNext(c) 
        Loop While Not c Is Nothing And c.Address <> firstAddress 
    End If 
End With

Changes every 2 to 5 within the Range A1:A500

(Why did I even wrote this?)

1

solved is it possible to select a range in Excel using VBA and put a value like text or some formulas?