LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
referencing cells based on conditions in other cells mirskman Excel Discussion (Misc queries) 1 January 29th 09 09:57 PM
Referencing several cells with IF? andim Excel Worksheet Functions 2 June 16th 08 11:24 AM
Referencing Cells PAL Excel Worksheet Functions 1 January 23rd 08 08:40 AM
Referencing other cells vfoley Excel Discussion (Misc queries) 4 April 30th 07 05:30 PM
Referencing Cells Bill W Excel Worksheet Functions 0 August 4th 05 05:10 PM


All times are GMT +1. The time now is 01:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"