VBA works in Windows XP, but not Windows 7

jrad

New Member
Joined
Jun 2, 2011
Messages
4
I've recently received an upgraded computer at work. Yay! However, it's running Windows 7 and several of my applications are not working properly anymore.

resultsSheet.Rows("11:" & maxrow).Select

is the statement that fails. I need to select all of the data from row 11 down and create a pivot table. Without selecting the data, I'm pretty sure I can't create the pivot table.

Any ideas would be greatly appreciated.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
The error message reads "Run-time error '1004': Select method of Range class failed.

Thanks again!:)
 
Upvote 0
resultsSheet needs to be the active sheet when this line of code is run.
Is it the active sheet?
 
Upvote 0
I believe so. Here's where you all are probably going to laugh at me. So, I'm running a query in MS Access and outputting the results to Excel. Then, I'm attempting to format the results. It's the only sheet up and should be the active sheet.

This is the code directly before the error.

Set objXLApp = CreateObject("Excel.Application")
Set objXLBook = GetObject(fPath & "\" & filename & ".xlsx")
Set resultsSheet = objXLBook.Sheets(filename)

resultsSheet.Cells.EntireColumn.AutoFit
resultsSheet.Cells.Font.Size = 8

resultsSheet.Range("A1:A10").EntireRow.Insert

resultsSheet.Cells(1, 4).Value = "Report Title "
resultsSheet.Cells(1, 4).Select

The resultsSheet.Cells(1,4).Select fails as well.

Does that help?
 
Upvote 0
Try putting this immediately before the line that is selecting cells :-

Code:
resultsSheet.Activate
 
Upvote 0
Thanks so much for the help. That didn't fix it. I'm also having the issue where Excel won't open certain files at all. I've called our company helpdesk. Hoping they can shed some light.
 
Upvote 0

Forum statistics

Threads
1,214,927
Messages
6,122,311
Members
449,080
Latest member
jmsotelo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top