Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
fetch values from w/sheet | Excel Discussion (Misc queries) | |||
Use of Indirect function to fetch data from another Excel file | Excel Worksheet Functions | |||
Sum cells based on a row variable and seperate column variable | Excel Worksheet Functions | |||
Cells.Find error Object variable or With block variable not set | Excel Programming | |||
Open a password protected excel workbook from second workbook to fetch data using dynamic connection | Excel Programming |