Need help with VB in Excel Spreadsheet

Need help with VB in Excel Spreadsheet

Post by Ken Sturge » Sun, 23 Feb 1997 04:00:00



I'm new to Visual Basic and even newer to using it with Excel. I have a
spreadsheet with employee records from several departments and I am trying to
run a macro that will search all the records (which may vary in number over
time) and pull out all of the employees that belong to a specific department
(D129A in this case). I would then like to copy the selected records to
another sheet. I have tried several variations that are similar to the
following code with no luck. Can anyone point out where I'm going wrong?

Sub PullD129A()
    Sheets("Sheet1").Select
    Range("A1").Select
    For Each ActiveCell In ActiveCell.CurrentRegion.Cells
        If Abs(ActiveCell.Value) = "129A" Then
            ActiveCell.EntireRow.Select
            Selection.Copy
            Sheets("Sheet2").Select
            ActiveSheet.Paste
        End If
    Next
End Sub

Thanks in advance for your assistance:-)

Ken Sturgeon

http://www.inlink.com/~fishhead

 
 
 

1. Q : Need help reading an Excel spreadsheet

I'm trying to read rows of an Excel spreadsheet in VB 5.0. I think I know
how to use the standard data control, assign connect type and databasename.
I assign a sheet name to recordsource, at design time. This works. What I
would like to do is be able to assign recordsource the first, or possibly a
user selectable, sheet out of the possible sheets in the spreadsheet. I
can't find any way of doing this with the data control. Do I have to go the
full blown route where I Dim DB as database, Dim tabledef, recordset, and
so on? Thanks for any help or guidance.

2. Update on multiple table

3. How to view Excel Spreadsheet in VB Form??

4. Progress and FreeBSD

5. Problems Updating Excel Spreadsheet using ADO and VB 6.0

6. 6.15 workstation engine and multi users

7. linking an excel spreadsheet to an access database using vb

8. How to improve the Procedue cache hit ratio on SQL Server 7.0?

9. Export tables to Excel Spreadsheet using VB

10. Inserting MS Access data into Excel spreadsheet in VB form

11. Send MS SQL Query results to Excel Spreadsheet using VB

12. Problems Updating Excel Spreadsheet using ADO and VB 6.0

13. Importing Excel Spreadsheet into an Access 2000 Table using VB