Results 1 to 1 of 1

How to use Cell value as variable in VB Macro

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    How to use Cell value as variable in VB Macro

    Hello:

    I am using the VB Macro as attached to paste certain range of data from closed monthly excelworkbook named
    "01_2013_Store1.xls" to current open excel file Called "2013_Yearly.xls", in sheet called "Inventory13".

    Currently I am manually changing the source file name every month to run the macro and manually changing
    the destination cell.

    In "Inventory13" sheet, i have field R40 where the name of the monthly file can be picked up.
    Example :
    R40=01_2013_Store1.xls,
    R40=02_2013_Stote1.xls, etc.

    Also, in "Inventory13" sheet, Cell F40:Q40 consist of Heading Jan,Feb,Mar....Dec

    i will choose the month from created dropdown list and this will be stored in Cell S40.

    Depending on the month, the data needs to be pasted.
    For Example,
    if S40 is Jan, then paste data at F41
    if S40 is Feb, then paste data at G41
    if S40 is Mar, then paste data at H41

    and so on..

    I want to modify the attached code to accomplish the above so that i don't have to manually change the macro every month.
    Basically, when i go to Inventory13 sheet and run the macro, the macro should pick up Monthly file name (Data Source) from cell R40 and month from field
    S40 to locate where to paste the data (Destination Cell).

    I hope this is clear, and please let me know if any question.

    Thanks in advance for the help

    Riz
    Attached Files Attached Files
    Last edited by rizmomin; 02-04-2013 at 06:04 PM.

Thread Information

Users Browsing this Thread

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

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