Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RMS RMS is offline
external usenet poster
 
Posts: 4
Default Passing the Value of a Cell to a VBA variable.

Is it possible to pass the contents of an Excel worksheet Cell to a VBA
variable for further processing? Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 342
Default Passing the Value of a Cell to a VBA variable.

dim vrtMyVariable as variant

vrtMyVariable = activecell.value

This will assign the value of the active cell to the variable named
vrtMyVariable

"RMS" wrote:

Is it possible to pass the contents of an Excel worksheet Cell to a VBA
variable for further processing? Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 257
Default Passing the Value of a Cell to a VBA variable.

Heck, yeah; it's practically the one fundamental necessity! If we couldn't
do even that, there wouldn't be much point in writing Excel programs at all.

TomPl was right as far as he went: ActiveCell.Value will get you the
contents of the cell that is currently selected. I just wanted to go a bit
further: Your program doesn't have to be limited to the active cell, but can
also get the contents of "A4", of the cell in row 23 column 5, of the cell at
row x1+3, column x2*2, of the top left cell in the selected range, of the
next cell that contains the string "000", pretty much anything you can think
of. It can get the text value, the formula, the font size, the column width,
its protection status...again, pretty much anything you can do in Excel you
can control from VBA/Excel.

Pardon my enthusiasm; you're just asking too small, that's all. :-)

--- "RMS" wrote:
Is it possible to pass the contents of an Excel worksheet Cell to a VBA
variable for further processing? Thanks.

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
Passing variable among controls [email protected] Excel Programming 0 January 25th 07 05:46 PM
VBA - Passing Cell Location To Variable ajocius[_35_] Excel Programming 2 October 4th 05 01:55 PM
Passing variable to Access Job Excel Programming 4 July 6th 05 03:52 PM
Passing variable to VarType of other Variable ExcelMonkey[_190_] Excel Programming 3 February 22nd 05 01:38 PM
Passing variable from one sub to another Medemper Excel Programming 0 February 26th 04 10:23 PM


All times are GMT +1. The time now is 11:33 PM.

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

About Us

"It's about Microsoft Excel"