how can i paste result from excel formula to value or even store the result into a string

below codes does not seem to works...

For x = 2 To rowcount
    worksheet2.Range("B" & x).Value = worksheet2.Range("D" & x).Text
    worksheet2.Range("C" & x).Value = worksheet2.Range("E" & x).Text
Next


worksheet2.Range("C" & x).Value = worksheet2.Range("E" & x).Text

please help... XD

Hi, elouch, welcome at DaniWeb!
I use the following:
To put a string into a cell:
worksheet.Cells[row, col] = aString
To get a string from a cell:
aString = worksheet.Cells[row, col].Value2.ToString()
Hope it helps.
The Cells object is a Range object, that I find much more easier to work with in this case.

Edited 2 Years Ago by ddanbe: Typo

or you could simly use the range if you are familiar with it
dim mystr as string
mystr = worksheet2.Range("D" & x).value

same to the others
And just incase if you get the not set exception then set the ranges before you have to use them

I hope this helps too.

This question has already been answered. Start a new discussion instead.