General discussion

Locked

Excel VBA: can I edit cells in VBA?

By tgrignon ·
I am trying to write some VBA to copy data to a cell and then to edit the data in that cell. Spefically I am copying information from a CSV file that looks like this: "Some Text" and I want it to look like this: Some Text or ="Some Text". So I want to be rid of the quotations or simply change it so it is a formula for a string.

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Excel VBA: can I edit cells in VBA?

by DKlippert In reply to Excel VBA: can I edit cel ...

Without going into detail about how you're importing the data, a rough piece of code might look like this:

Sub CleanData
Cells.Replace What:="""", Replacement:=""
End Sub

You might do better by changing the extention and then recording a macro as Excel parses the file.

Also look at:

www.cpearson.com/excel/imptext.htm

Collapse -

Excel VBA: can I edit cells in VBA?

by tgrignon In reply to Excel VBA: can I edit cel ...

The question was auto-closed by TechRepublic

Collapse -

Excel VBA: can I edit cells in VBA?

by pancras In reply to Excel VBA: can I edit cel ...

You can place a value in cell a1 with

in current sheet
range("a1").value="Some text"

in sheet1 (not current sheet but current workbook)
sheets("sheet1").range("a1").value="some text"

"some text" can be in say a3 so
range("a1").value=Mid(Range("a3").Value, 2, Len(Range("a3").Value) - 2)
should do the trick

Collapse -

Excel VBA: can I edit cells in VBA?

by tgrignon In reply to Excel VBA: can I edit cel ...

The question was auto-closed by TechRepublic

Collapse -

Excel VBA: can I edit cells in VBA?

by tgrignon In reply to Excel VBA: can I edit cel ...

This question was auto closed due to inactivity

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums