Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
fetch values from w/sheet TUNGANA KURMA RAJU Excel Discussion (Misc queries) 0 April 2nd 09 03:43 AM
Use of Indirect function to fetch data from another Excel file Boon8888 Excel Worksheet Functions 1 January 20th 06 07:46 PM
Sum cells based on a row variable and seperate column variable CheeseHeadTransplant Excel Worksheet Functions 10 September 23rd 05 06:59 PM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM
Open a password protected excel workbook from second workbook to fetch data using dynamic connection kaustav choudhury Excel Programming 2 April 3rd 04 06:18 AM


All times are GMT +1. The time now is 07:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"