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: 1
Default Have Excel VB Read from two sheets


Goodmorning!

I don't know much about VB, but I have an excel workbook that has VB.
I have updated it in the past to read current info, but have now run
out of space on the first worksheet and will need to start adding info
to a second worksheet. I need to know how to get excel to read the
second worksheet, when a particular Schedule is seleted. All of the
info it currently reads is on a sheet called, "PPO". I am now going to
have a second sheet and need it to read from there when it gets to say,
Sch #704

I'm attaching part of the VB code.

Any help would be greatly appreciated.


Thanks,



Dim Schedule_No As String
Dim ADA_No As String


Sub calculate()
Let Schedule_No = Sheets("PPO").[B5]
Let ADA_No = Sheets("PPO").[B8]

Range("A1").Select
ActiveCell.Offset(0, 10).Activate

Call calculate_ADA(ADA_No)
Sheets("PPO").[F2].Value = ActiveCell.Value

Call calculate_Schedule(Schedule_No)
Sheets("PPO").[F1].Value = ActiveCell.Value

SendKeys "{Tab}"
Range("A5").Select


End Sub
Sub calculate_ADA(ADA_No)

Select Case ADA_No
Case "D0120", "d0120"
ActiveCell.Offset(1, 0).Activate
Case "D0140", "d0140"
ActiveCell.Offset(2, 0).Activate
Case "D0150", "d0150"
ActiveCell.Offset(3, 0).Activate
Case "D0160", "d0160"
ActiveCell.Offset(4, 0).Activate
Case Else
Range("B8").Activate
End Select
End Sub
Sub calculate_Schedule(Schedule_No)

Select Case Schedule_No
Case 700
ActiveCell.Offset(0, 1).Activate
Case 701
ActiveCell.Offset(0, 2).Activate
Case 702
ActiveCell.Offset(0, 3).Activate
Case 703
ActiveCell.Offset(0, 4).Activate
Case Else
Range("B5").Activate
End Select
End Sub


--
cowannbell
------------------------------------------------------------------------
cowannbell's Profile: http://www.excelforum.com/member.php...o&userid=24522
View this thread: http://www.excelforum.com/showthread...hreadid=381184

 
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
min & average 52 work sheets all read zero Mike Excel Discussion (Misc queries) 1 November 10th 09 10:07 AM
I have a read only xl file, I need it to be read and write drama queen Excel Discussion (Misc queries) 3 July 1st 06 12:25 AM
How can a file be converted from Read-Only to Read/Write Jim in Apopka Excel Discussion (Misc queries) 2 November 19th 05 04:59 PM
In Excel is there a way to read the name of the sheets tab and di. Neil Excel Worksheet Functions 3 November 13th 04 07:47 PM
Excel sheets saved as XML files that can be read by .NET nabil Elibiary Excel Programming 1 December 8th 03 08:40 AM


All times are GMT +1. The time now is 06:13 PM.

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

About Us

"It's about Microsoft Excel"