Click here to Skip to main content
15,895,462 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi there,

I want to import data from sql server into Excel using vba. The problem is I don't want the data to fire in sheet1 but rather in sheet2 but I 'm having problems setting the range for sheet2. In sheet1 is a button.

VB
' Remove any values in the cells where to fire the sp results.

Dim rngRange As Range
Set rngRange = ThisWorkbook.Worksheets("Sheet2").Range(Cells(2, 1), Cells(Rows.Count,1)).EntireRow  
rngRange.ClearContents


The error is on the line 'Set rngRange= ...'
Posted
Updated 1-Jul-15 3:48am
v2
Comments
Richard Deeming 1-Jul-15 14:27pm    
And are we expected to guess what the error is?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900