+ Reply to Thread
Results 1 to 7 of 7

Need some help with a simple (but challening) Macro

  1. #1
    Registered User
    Join Date
    09-19-2006
    Posts
    3

    Need some help with a simple (but challening) Macro

    Hello, I was wondering if I could get some advice on where to begin on a macro project I have just begun…

    I will try to explain…

    What I want to be able to do is input a variable X into an EXCEL form which will then take the cell value starting from CELL 1 skipping over every other cell as specified by the value X and transfer those values into a new sheet - (I know that was a bad description) Here is a real example of what I need to be able to accomplish

    I have a large workbook full of data, In this particular case I need the value of every firth cell in a column starting from Cell 1, Cell 5, Cell 10, Cell 15 , Cell 20…Etc I then want to be able to take those numbers and have them imported into a new work sheet (Or possibly even just modify the current sheet and delete every 4 cells leaving every fith cell intact and then cleaning up the gaps)

    The challenge for me is that each time I run this macro I would need to be able to use a different Value for X where some times I would want only every fith column value, and maybe other times I would only want every third value from the cell -

    Does anyone happen to know of anything like this already made? My programming skills are not what they used to be and I could use some help on just even getting started on this!

    Thank you in advance!
    Asterix

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Obelix would answer it is feasible ... without any "potion magique" ...

    Is your modulo value 5, 3 etc an input or a known variable ?

    For precise help and VBA coding, one would require more specifics ...

    HTH
    Cheers
    Carim

  3. #3
    Forum Contributor colofnature's Avatar
    Join Date
    05-11-2006
    Location
    -
    MS-Off Ver
    -
    Posts
    301
    If your data starts in "Sheet1" and you want it moved to "Sheet2":

    Please Login or Register  to view this content.

    HTH
    Col
    Last edited by colofnature; 09-19-2006 at 02:35 PM.
    If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime.

  4. #4
    Registered User
    Join Date
    09-19-2006
    Posts
    3
    Carim,

    Thank you for your quick reply! (amazing) The values are all known values - There are no formulas or anything being done to the cells, Basically the spread sheet is just being used to record and store data -

    To give you more background on the problem if we have a sheet that looks like this

    A | B | C |
    2.3 tt xx
    3.4 dd vv
    1.1 dd cc
    2.2 ff gg
    4.3 df fd
    2.3 aa cc
    1.3 cc ew
    4.3 fs ff
    4.3 vv vv

    From column A we would in this case for (X) want to have every third row value pasted or imported into a new sheet...So the end final product result in this case from the example above would look like this (every third row value starting with 1)

    A | B | C |
    2.3 tt xx
    1.1 dd cc
    2.3 aa cc
    4.3 vv vv

    So we would have a spreadsheet that was essentially reduced by one third...But would vary from sheet to sheet how many rows we would want to skip --- Does this make more sense?

  5. #5
    Registered User
    Join Date
    09-19-2006
    Posts
    3
    Quote Originally Posted by colofnature
    If your data starts in "Sheet1" and you want it moved to "Sheet2":

    Please Login or Register  to view this content.

    HTH
    Col
    Colofnature

    This program is actually just what I needed! Thank you very much I just need to be able to specify a starting row (which I think I can handle) in which to execute the macro from -

    Thanks again! big help

  6. #6
    Forum Contributor colofnature's Avatar
    Join Date
    05-11-2006
    Location
    -
    MS-Off Ver
    -
    Posts
    301
    No worries - but I spotted a wee mistake when I glanced over the quote: the 2 instances of "i * rows_to_skip" in the code should have been "1 + i * rows_to_skip" - I've edited the original posting... sorry.

    C

  7. #7
    Forum Contributor colofnature's Avatar
    Join Date
    05-11-2006
    Location
    -
    MS-Off Ver
    -
    Posts
    301
    Oh and change the 1 in the "1 + i ..." I just mentioned to whatever row you want to start at: so if you want to start at row 2, where x=3 it would copy rows 2, 5, 8 etc

+ 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