LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default WorkSheet or AutoFilter Problem

Tom;

Thanks for getting back! The error message has changed, but I did go
to the next line before I got it..

I get this message (I was getting before I made the typo, that is why
I tried the Do Loop) I keyed l instead of 1. However both sheets never have
any data in them, this is why I tried something I found from the users group.

The Information cannot be pasted because the Copy area and the paste area
are not the same size and shape.

Thanks

John Q.


"Tom Ogilvy" wrote:

Criteria should have the numberal 1 on the end. Yours doesn't

.Columns(12).AutoFilter Field:=1, Criteria1:="AAA"

worked fine for me.

--
Regards,
Tom Ogilvy


"John Quinn" wrote:

I searched the users group and came up with some changes, but still cannot
get this portion of my macro to work!

On the first example Marked by '*, I get a hard halt.

My second example the WorkSheet never has any data in it?

I will be happy with either method, if someone knows what is wrong?

ClassAAAA

Dim wkst As Worksheet ' Current Sheet
Dim lbls As Workbook
Dim wslb As Worksheet ' Work Sheet
Dim lastRow As Long

Set wkst = ActiveSheet
Set lbls = Workbooks.Add(1)
Set wslb = lbls.Worksheets(1)
lbls.Title = "Letters to Educators"
lbls.Subject = "Grades"

With wkst
.AutoFilterMode = False
.Columns(12).AutoFilter Field:=1, Criterial:="AAA" '*
Application-defined or Object-defined Error
.Columns(2).Copy wslb.Columns(2)
.Columns(5).Copy wslb.Columns(3)
.Columns(7).Copy wslb.Columns(4)
.Columns(8).Copy wslb.Columns(5)
.Columns(9).Copy wslb.Columns(6)
End With

wslb.SaveAs Filename:="C:\ExcelExp\TxLabels.xls",
FileFormat:=xlNormal

MsgBox "Class AAAA Completed"

End Sub

' Also Tried Thsi Method

Sub ClassAAA()

Dim wkst As Worksheet ' Current Sheet
Dim lbls As Workbook
Dim wslb As Worksheet ' Work Sheet
Dim lastRow As Long
Dim chkClass As String

Set wkst = ActiveSheet
lastRow = Range("L" & Rows.Count).End(xlUp).Row
Range("L1").Select
chkClass = "AAA"

SelCol = InputBox("Enter the Column for the Educator You Want to
Send Letters to:!")
Set lbls = Workbooks.Add

With lbls
.Title = "Letters to Educators"
.Subject = "Grades"
End With

Set wslb = ActiveSheet
Do Until ActiveCell.Row lastRow
If ActiveCell.Value = chkClass Then '*
ActiveCell.Value is Always Empty
wkst.Columns(3).Copy wslb.Columns(2)
wkst.Columns(5).Copy wslb.Columns(3)
wkst.Columns(7).Copy wslb.Columns(4)
wkst.Columns(8).Copy wslb.Columns(5)
End If
ActiveCell.Offset(1, 0).Activate ' Move to Next Row
Loop

wslb.SaveAs Filename:="C:\ExcelExp\TxLabels.xls",
FileFormat:=xlNormal

MsgBox "Class AAA Completed"

End Sub

There is just something I am not understanding, one of my worksheets must
have something in memory?

Again, a lot of this code came from users in the group.

Thanks Again

J.Q.



 
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
Problem using Autofilter [email protected] Excel Programming 1 May 22nd 07 12:15 AM
PROBLEM WITH AUTOFILTER OMIDF New Users to Excel 0 August 18th 06 05:36 PM
AutoFilter VBA Problem Michael Link Excel Discussion (Misc queries) 1 July 28th 06 04:41 PM
Autofilter problem Tom Ogilvy Excel Programming 1 June 2nd 05 07:28 PM
Problem with autofilter in VBA godgo Excel Programming 1 January 14th 04 01:33 PM


All times are GMT +1. The time now is 12:00 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"