Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Referencing Cells in VB
I am attempting to write a macro that will pull information from a spreadsheet into a list on another sheet. For instance, I have many pieces of equipment and want to see only the equipment for a certain system, so I type in the system I want, hit my button, and go. I am running into problems with searching to the next cell in the spreadsheet. This is the code I have so far
Private Sub CommandButton2_Click() 'Creating Report Number One t = 1 System = Sheets("input").Range("E3") Do While t < 10 ActualSystem = Sheets("electrical").Range("At") If System = ActualSystem Then Sheets("electrical").Range("At").Copy Destination:= _ Sheets("report").Cells(Rows.Count, 1).End(x1Up) _ .Offset(1, 0) t = t + 1 Else t = t + 1 End If Loop End Sub I want it to put only the pieces of equipment for that particular system on the list, and I want to have it where there are no blank spaces between the pieces of equipment on the list. The system is numbered like this: "Bxx" with xx being any integers. I know I am referencing the cells wrong in Excel, I know you just cant say Cell (At) and have t be counted each time through, which is the problem I am running into, it gives me a runtime error whenever it gets to the ActualSystem variable. Any help on this matter would be greatly appreciated. Thanks. Brian |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
referencing cells based on conditions in other cells | Excel Discussion (Misc queries) | |||
Referencing several cells with IF? | Excel Worksheet Functions | |||
Referencing Cells | Excel Worksheet Functions | |||
Referencing other cells | Excel Discussion (Misc queries) | |||
Referencing Cells | Excel Worksheet Functions |