+ Reply to Thread
Results 1 to 13 of 13

Macro for Moving Data

Hybrid View

  1. #1
    Registered User
    Join Date
    09-01-2007
    Posts
    24

    Macro for Moving Data

    I am hoping some one can help me create a macro for my problem.
    I need to move a lot of data from what was originally a txt document into an easily readable form.
    I have used Macro's before but only for very basic routines (so please treat me as a bit dumb when it comes to Macro’s).
    I have Include Screen shot of the data highlighted in a colored box and the relevant colored cell I need to move it into.
    This needs to be repeated many times with data that is consistent in its layout.
    Thanks Gary
    Attached Images Attached Images

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Hawkmoon,

    It seems your post cropped some cells on the worksheet. It would be best to post the workbook. That way it is clear were your data is coming from, how it is formatted, and were it will go.

    Thanks,
    Leith Ross

  3. #3
    Registered User
    Join Date
    09-01-2007
    Posts
    24
    The rest of the work book is the same, Just different Values. But I will Post it any way. Thank you for your help Gary
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    09-01-2007
    Posts
    24
    The rest of the work book is the same, Just different Values. But I will Post it any way. Thank you for your help Gary

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You could probably use Split, but can you attach a zipped workbook with some sample data & layout?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Registered User
    Join Date
    09-01-2007
    Posts
    24

    Zip File included

    Sorry guys I did not have any Zip utility I have installed one Hope you can fix my Problem.
    I do not Know what split is LOL
    Thanks Gary
    Attached Files Attached Files

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Hawkmoon,

    The macro here has been added to the attached workbook. You can use CTRL+Z as the shortcut to run it.
    Sub LoadData()
    
      Dim Data As Variant
      Dim LastRow A Long
      Dim R As Long
      Dim StartRow As Long
    
        StartRow = 9
        LastRow = 138
        
        Application.ScreenUpdating = False
        
          For R = StartRow To LastRow Step 13
            Data = Split(Cells(R + 4, "A"), ",")
              Cells(R + 9, "G") = Data(1)
            Data = Split(Cells(R + 6, "A"), ",")
              Cells(R + 3, "G") = Data(0)
              Cells(R + 7, "G") = Data(2)
            Data = Split(Cells(R + 7, "A"), ",")
              Cells(R + 1, "G") = Data(0)
              Cells(R + 5, "G") = Data(2)
            Cells(R + 11, "G").Formula = "=G" & Trim(Str(R + 9)) & "*6"
          Next R
          
        Application.ScreenUpdating = True
           
    End Sub
    Sincerely,
    Leith Ross
    Attached Files Attached Files

+ 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