Hi guys, I will appreciate any suggestion.
I am reading the fields of a record set from the first field to the last one in order to write the data of each field into different cell addresses in a spreadsheet. What I need to know what is the correct syntax to refer correctly my variable name "CellTarget" containing the cell address (column letter and the row number) in the instruction :
Worksheets("Form").Range(CellTarget).Value = Rs.Fields(i)
I need this instruction to assign the value from any Rs.Fields(i) to a cell address, but referring to the name of my variable.
Works perfect in this way :
Worksheets("Form").Range("$E$6").Value = Rs.Fields(i)
I need to get the same result using my variable name?
Ex. Celltarget ="$E$6"
Worksheets("Form").Range(CellTarget).Value = Rs.Fields(i)
Obviously if I have tried to work the code like it is stated in the last line above and it gives me an error. Looks like it is matter of some syntax issue.
Thanks so much in advance for any advice
GonFer
I am reading the fields of a record set from the first field to the last one in order to write the data of each field into different cell addresses in a spreadsheet. What I need to know what is the correct syntax to refer correctly my variable name "CellTarget" containing the cell address (column letter and the row number) in the instruction :
Worksheets("Form").Range(CellTarget).Value = Rs.Fields(i)
I need this instruction to assign the value from any Rs.Fields(i) to a cell address, but referring to the name of my variable.
Works perfect in this way :
Worksheets("Form").Range("$E$6").Value = Rs.Fields(i)
I need to get the same result using my variable name?
Ex. Celltarget ="$E$6"
Worksheets("Form").Range(CellTarget).Value = Rs.Fields(i)
Obviously if I have tried to work the code like it is stated in the last line above and it gives me an error. Looks like it is matter of some syntax issue.
Thanks so much in advance for any advice
GonFer