![]() |
To fetch the values from the excel cells into the variable
Hello,
I have tried to extract the data from a range of cells into local variable so that I can write the extracted data in the freefile using VB code. Can you kindly let me know what will be the correct code. Below is the way I have tried, but assinging to variable always results in type mismatch error. X2 = StrConv(Selection.Value, vbUpperCase) Thanks and Regards Chetana |
To fetch the values from the excel cells into the variable
the above code works perfectly fine for me. I tried
abc = StrConv(ActiveSheet.Range("A1").Value, vbUpperCase) MsgBox (abc) it prints XABC (Cell A1 has the string Xabc) The only probelm you could have is the definition of your variable X2 Just say Dim X2 or Dim X2 as variant you must have probably defined it as a number type like int or double in which case you would get the type mismatch error in case the valu is a string. - Manges -- Message posted from http://www.ExcelForum.com |
To fetch the values from the excel cells into the variable
Is your Selection a single cell?
What did you "Dim" X2 as? Do you have any errors in your Selection? In article , (chetana) wrote: Hello, I have tried to extract the data from a range of cells into local variable so that I can write the extracted data in the freefile using VB code. Can you kindly let me know what will be the correct code. Below is the way I have tried, but assinging to variable always results in type mismatch error. X2 = StrConv(Selection.Value, vbUpperCase) Thanks and Regards Chetana |
All times are GMT +1. The time now is 08:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com