+ Reply to Thread
Results 1 to 5 of 5

Assign Cell value to a variable

  1. #1
    Registered User
    Join Date
    11-20-2010
    Location
    Delaware, USA
    MS-Off Ver
    Excel 2003
    Posts
    73

    Assign Cell value to a variable

    Hello all,

    Long time-- no post. Hope all is well!

    I need some assistance with a macro I'm working on. This should be pretty simple.

    I need to take the value of cell C8 on the Home Tab of my active workbook and assign it to a variable (I believe an integer). The variable will be used as a date filter. (The input cell is a short date).

    Here is what I have:

    Please Login or Register  to view this content.

    Thanks again!!
    Last edited by Pergo; 03-18-2015 at 03:08 PM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Assign Cell value to a variable

    Declare filterdate as type Date or Long

    Dim filterdate As Date

    Otherwise, I'm not sure what assistance you need?
    Last edited by AlphaFrog; 03-18-2015 at 02:42 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    11-20-2010
    Location
    Delaware, USA
    MS-Off Ver
    Excel 2003
    Posts
    73

    Re: Assign Cell value to a variable

    Excellent!! Thanks!

    This is now a separate question. How can I count how many rows are display from the filtered data and put it into an integer?

    So now if 35 line items show up with the filter, how can i assign 35 to a variable?

    Thanks!

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Assign Cell value to a variable

    This counts the header row as well.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-20-2010
    Location
    Delaware, USA
    MS-Off Ver
    Excel 2003
    Posts
    73

    Re: Assign Cell value to a variable

    Perfect! Thanks!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 07-24-2012, 11:47 AM
  2. [SOLVED] VBA variable assign on cell search
    By kamelkid2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2012, 02:23 PM
  3. Assign cell value to variable
    By Rookie_User in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-02-2012, 04:39 PM
  4. [SOLVED] assign cell content to variable
    By echomom in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-26-2011, 01:47 PM
  5. How do I assign the value in a cell to a variable?
    By JasonK in forum Excel General
    Replies: 8
    Last Post: 06-07-2006, 06:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1