Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 25th, 2005, 02:31 PM
Authorized User
 
Join Date: Feb 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Seperateing Data

Hello. This will be my last question

I have 4 Colums of Data, going down about 100 cells every 6 or so rows are specific information that can't be moved around. For instance
 A B C D
1A|83|34|109
2A|32|34|65
3A|45|78|12
4A|12|89|45
5A|34|45|56
6B|56|90|56
7B|34|45|54
8B|23|78|12

This would go down A, B, C,D,E etc... where ever it stops

Since there is no Space between A and B (meaning i can't search for blank space to tell where specific information in Coloumn D begins or ends) How would I be able to Select the important information in Coloumn D belonging to A

If this is confuseing please let me know, and i'll try to reword it.

Thanks in advance for any help

Keith

 
Old June 6th, 2005, 10:10 AM
Authorized User
 
Join Date: Aug 2004
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Before proceeding. If you somehow want to make totals of the data a pivot table will do the job fast and accurately.

Here is some code to do what you asked (I think). Again, using Select is not a good way of doing things,
Code:
Sub test()
    Dim ws As Worksheet
    Dim FromRow As Long
    Dim StartRow As Long
    Dim EndRow As Long
    Dim MyVal As String
    Dim MyRange As Range
    '------------------------------------------
    Set ws = ActiveSheet
    FromRow = 1
    '------------------------------------------
    '- loop all data
    While ws.Cells(FromRow, 1).Value <> ""
        MyVal = ws.Cells(FromRow, 1).Value
        StartRow = FromRow
        '---------------------------------------
        '- loop column 1 value
        While ws.Cells(FromRow, 1).Value = MyVal
            FromRow = FromRow + 1
        Wend
        '---------------------------------------
        '- get column D cells
        EndRow = FromRow - 1
        With ws
            Set MyRange = _
                .Range(.Cells(StartRow, 4), .Cells(EndRow, 4))
        End With
        MyRange.Select
        '------------------------------------------
        'wait 1 second ( put what you want to do with the data)
        Application.Wait Now + TimeValue("00:00:01")
   Wend
End Sub
-----------------------
Regards BrianB
Most problems occur from starting at the wrong place.
Use a cup of coffee to make Windows run faster.
It is easy until you know how.





Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in e-mail structure sending data from data tiawebchd General .NET 3 May 5th, 2008 08:07 AM
Data Binding - Editing GridView Row Data desk_star BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 7 December 30th, 2007 11:07 AM
Transfering data from csv file to data base g_vamsi_krish ASP.NET 1.0 and 1.1 Professional 2 May 16th, 2006 11:58 PM
Binding to Filtered Data (or Data subsets) gdbjohnson C# 8 August 27th, 2004 01:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.