PDA

View Full Version : [SOLVED:] Could this possibly be a problem in Excel 2000



K. Georgiadis
09-29-2005, 01:28 PM
http://vbaexpress.com/forum/attachment.php?attachmentid=2018The attached code (compliments of XLD :bow: ) works fine on my PC (with Office XP). One of the users who uses Excel 2000 reported a workbook "lock up" which I am investigating. With my limited knowledge, I don't see anything that would cause any problems but I would appreciate your expert opinions.

And, since you are looking at the code, is it possible for the cursor to end up on cell A1 (or B1, or C1) after performing the filter and paste?

Norie
09-29-2005, 01:47 PM
There's nothing in that code that I can see causing an version issue.

lucas
09-29-2005, 02:05 PM
I don't have office 2000 either so I cant check your lock up problem but you can add:

Range("A2").Select

to the end of your code to solve your second problem.....

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Dim sChoice As String
Dim iLastRow As Long
Dim rng As Range
Dim pArray
pArray = [{"Industrial","I";"Farming","F";"Hardwoods","H";"Others","O"}]
On Error GoTo ws_exit:
Application.EnableEvents = False
iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
Set rng = Range("A1:H" & iLastRow)
FilterAndCopy rng, pArray(1, 1), pArray(1, 2)
FilterAndCopy rng, pArray(2, 1), pArray(2, 2)
FilterAndCopy rng, pArray(3, 1), pArray(3, 2)
FilterAndCopy rng, pArray(4, 1), pArray(4, 2)
rng.AutoFilter
ws_exit:
Application.EnableEvents = True
Range("A2").Select
End Sub

K. Georgiadis
09-29-2005, 05:27 PM
Perfect!!!I had tried this but clearly I had the command in the wrong location. Marking solved, with my thanks...:beerchug: