Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-27-2017, 09:30 PM
H28Sailor H28Sailor is offline macro error message - interpretation Windows 7 32bit macro error message - interpretation Office 2007
Advanced Beginner
macro error message - interpretation
 
Join Date: Mar 2013
Posts: 55
H28Sailor is on a distinguished road
Default macro error message - interpretation

Hi
I have the following macro:-
Sub CopyRows()
' copy all rows of data in worksheet 'temp' to the appropriate worksheets
Dim iLooper As Long, NextRow As Long, ws As Worksheet, strSheet As String
With Worksheets("temp")
For iLooper = 1 To .Cells(Rows.Count, 1).End(xlUp).Row
If UCase(Trim(.Cells(iLooper, "B").Value)) Like "ENROLLMENT*" Then
strSheet = "ENROLLMENT"
ElseIf UCase(Trim(.Cells(iLooper, "B").Value)) Like "WEEK*" Then
strSheet = .Cells(iLooper, "a").Text
Else
strSheet = ""
End If
If strSheet <> "" Then
Set ws = Worksheets(strSheet)
NextRow = ws.Columns("B").Find("*", , xlValues, , 1, 2).Row + 1


ws.Rows(NextRow).Insert
ws.Cells(NextRow, "A").Resize(, 8).Value = _
.Cells(iLooper, "A").Resize(, 8).Value
End If
Next
End With
' delete all rows of data in worksheet 'temp'
Dim r As Long
For r = Cells(Rows.Count, 1).End(xlUp).Row To 3 Step -1
If Cells(r, 1) <> "" Then Rows(r).Delete
Next r
End Sub

When I run it I get the following error:-
Run-time error '91' :
Object variable or With Block variable not set
with the red line highlighted

Any suggestions on what is going wrong

Bob M
p.s. this macro was working OK before ?????
Reply With Quote
  #2  
Old 03-01-2017, 02:47 AM
Logit Logit is offline macro error message - interpretation Windows 10 macro error message - interpretation Office 2007
Expert
 
Join Date: Jan 2017
Posts: 587
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

What changes were made since the last time it worked ?

Also, perhaps Dim "Columns" and / or "Row" ? Can't test it here cuz I can't replicate your workbook. Taking a stab at the issue.
Reply With Quote
  #3  
Old 03-02-2017, 09:00 PM
H28Sailor H28Sailor is offline macro error message - interpretation Windows 7 32bit macro error message - interpretation Office 2007
Advanced Beginner
macro error message - interpretation
 
Join Date: Mar 2013
Posts: 55
H28Sailor is on a distinguished road
Default

Hi

I have not changed anything that is related to the macro

It is supposed to copy all 'Enrollment' data to an Enrollment tab
all No. 1 data to tab 1
all No. 2 data to tab 2 etc and finally delete all data from temp tab which is where the macro button is

I am hoping somebody can interpret the error message

Bob M
Reply With Quote
  #4  
Old 03-03-2017, 07:37 AM
Logit Logit is offline macro error message - interpretation Windows 10 macro error message - interpretation Office 2007
Expert
 
Join Date: Jan 2017
Posts: 587
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

If you are willing to post your project to a download site (Amazon Cloud, Google, MS One Cloud, etc) I can review it to determine the cause (hopefully).

Remove all confidential data before doing so.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro error message - interpretation Reserved error(-1517); there is no message for this error ktest Office 1 02-12-2016 08:08 PM
macro error message - interpretation 5941 error message in macro used in merge moneal62 Word VBA 6 01-18-2016 07:54 PM
macro error message - interpretation Automation error Unknown error" message once they open the Excel file hlina Excel 1 10-08-2013 09:14 PM
Error message White House Outlook 1 12-07-2010 04:52 AM
sent mail error message Carolemc Outlook 0 09-26-2006 03:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:32 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft