Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Simple oversight on my part in this code I'm sure

In my mind, the following code is simple. It waits to see what is chosen in
cell E10 of two possible choices through data validation, and then
run a procedure based on what is chosen.

Cell E10 is one sheet within the same workbook and the ranges to be copied
are in another sheet in the same workbook. The code resides in the sheet
where E10 is.

Problem is, when I choose something in E10, nothing happens. Can
anyone help me?

Private Sub Workbook_SheetSelectionChange(ByVal Sheet As Object, ByVal
Target As Excel.Range)
If Target = "E10" Then
Select Case Range("E10").Value
Case "N/A"
Range("QBQuery1_1Criteria!O1:O530").Select
Selection.Copy
Range("QBQuery1_1Criteria!K1").Select
ActiveSheet.Paste
Case "All Projects Actual"
Range("QBQuery1_1Criteria!P1:P530").Select
Selection.Copy
Range("QBQuery1_1Criteria!K1").Select
ActiveSheet.Paste
End Select
End If
End Sub
--
paul
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Simple oversight on my part in this code I'm sure

SelectionChange fires when you select the cell - so the value hasn't
changed. Try using the change event.

Target will probably never have a value of "E10". I suspect you want to
check the address of the changed cell.

Private Sub Workbook_SheetChange(ByVal Sheet As Object, _
ByVal Target As Excel.Range)
If Target.address = "$E$10" Then
Select Case Target.Value
Case "N/A"
Range("QBQuery1_1Criteria!O1:O530").Select
Selection.Copy
Range("QBQuery1_1Criteria!K1").Select
ActiveSheet.Paste
Case "All Projects Actual"
Range("QBQuery1_1Criteria!P1:P530").Select
Selection.Copy
Range("QBQuery1_1Criteria!K1").Select
ActiveSheet.Paste
End Select
End If
End Sub



--
Regards,
Tom Ogilvy


"pglufkin" wrote in message
...
In my mind, the following code is simple. It waits to see what is chosen
in
cell E10 of two possible choices through data validation, and then
run a procedure based on what is chosen.

Cell E10 is one sheet within the same workbook and the ranges to be copied
are in another sheet in the same workbook. The code resides in the sheet
where E10 is.

Problem is, when I choose something in E10, nothing happens. Can
anyone help me?

Private Sub Workbook_SheetSelectionChange(ByVal Sheet As Object, ByVal
Target As Excel.Range)
If Target = "E10" Then
Select Case Range("E10").Value
Case "N/A"
Range("QBQuery1_1Criteria!O1:O530").Select
Selection.Copy
Range("QBQuery1_1Criteria!K1").Select
ActiveSheet.Paste
Case "All Projects Actual"
Range("QBQuery1_1Criteria!P1:P530").Select
Selection.Copy
Range("QBQuery1_1Criteria!K1").Select
ActiveSheet.Paste
End Select
End If
End Sub
--
paul



Reply
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
Simple If, If part 2 (clarification) Steve Excel Worksheet Functions 3 July 20th 07 09:28 PM
VB Code Corerection Part 2!! RichIT Excel Programming 1 August 10th 06 05:19 PM
Simple Question, display only part of a date in Number format DB Explorer Excel Worksheet Functions 6 March 17th 06 11:47 AM
Hiding Part of the VBA Code Matt Excel Programming 5 June 7th 04 07:07 PM
Simple VB Script - Part 2 Graeme[_3_] Excel Programming 2 February 2nd 04 08:39 PM


All times are GMT +1. The time now is 12:14 AM.

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"