+ Reply to Thread
Results 1 to 3 of 3

VBA - Search xls spreadsheet for specific data and move cell value up one position

  1. #1
    Registered User
    Join Date
    03-07-2013
    Location
    Albuquerque, NM
    MS-Off Ver
    Excel 2003
    Posts
    2

    VBA - Search xls spreadsheet for specific data and move cell value up one position

    Hello,

    I am very new to VBA programming and have been searching for some time for some examples or solutions to what appears to be an almost unique question about XLS spreadsheets. I am still a bit of a noob, so I do apologize up front.

    I have a spreadsheet in which every other row of data in column "C" has a static value of "9999". Within those rows at column "Q" is a variable value in the cell. I am looking to find an external script (not a macro that requires me to open excel in order to run, as I need to be able to run this script from within a batch file in the command line, preferably with the excel window not being shown) in which to find each of these rows, shift the data in column "Q" up by one cell and delete the row containing the static number in order to shorten the excel spreadsheet.

    I.E. cell "C2" has the static number of "9999" and cell "Q2" has a variable of "1234". I need to shift the data in cell "Q2" to cell "Q1" and delete the row containing the "9999", but continue parsing the file in the same manner for every other row containing the "9999".

    Any help in finding a solution to this scripting issue is greatly appreciated. Links, articles, or even a piece of code or two will help immensely.

    Thank you,

    Quintin

  2. #2
    Forum Contributor
    Join Date
    07-16-2012
    Location
    Ontario Canada
    MS-Off Ver
    Excel 2010
    Posts
    124

    Re: VBA - Search xls spreadsheet for specific data and move cell value up one position

    You can set the Macro to run when it opens.
    That way you can open the workbook from the command line then it will run on its own.

    You can do this by opening the VBA editor.
    On the left hand pane, double click your current workbook, then the Microsoft Excel Objects.
    Double click ThisWorkbook.
    Then at the top of the script area you will see 2 dropdown menus.
    Set the first one to Workbook. The second should set to Open by default.
    You can put your code in there.

  3. #3
    Registered User
    Join Date
    03-07-2013
    Location
    Albuquerque, NM
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: VBA - Search xls spreadsheet for specific data and move cell value up one position

    The problem is the excel file must be parsed in the background without being physically shown to the user. Due to that reason, I am trying to perform all actions in a scripted file format so that the operation may be launched from a Java program that I have been working on and never shown throughout the process of parsing to the user. I need as little interaction as possible from the end user towards generating the end resulted XLS file.

    Where as I like the idea of running it through a macro, I also do not have any knowledge of working with the macro recorder in such a fashion to generate enough code to place into a VBS file. It is something that I have had very little experience with until recently in which my boss handed me this project to figure out.

    To press it a little more why it can't be a macro... there are several excel workbooks that I must perform this action on before the section of my script comes in to rename the parsed XLS files and move them to another directory for archiving.

    Thank You,

    Quintin
    Last edited by qnmahan; 03-08-2013 at 06:00 PM.

+ Reply to Thread

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