VBA properties not coming after dot

MAHAVISHNU

New Member
Joined
May 31, 2018
Messages
5
Dear All,

I have few doubt in VBA. when ever I write the VBA code i am getting Auto Properties list after dot(.). for some cases i could not the list while writing the code. but there is no error. even if I run the code I am getting the result. there is no error in code. But why the Auto properties not coming some times. this make me lot of trouble which very difficult to fin the properties.

Here i have few sample code.

in the below code I set the source worksheet. now i want to set the range from the source sheet. when I enter the code i am not getting the range properties after dot.

please clarify what i have missed in VBA procedure.

Rich (BB code):
Sub pivot_test_2()


Dim source_st As Variant
Dim pivot_st As Variant
Dim pt As PivotTable
Dim start_rng As Variant
Dim data_rng As Variant


Set source_st = ThisWorkbook.Sheets(3)
Set pivot_st = ThisWorkbook.Worksheets(9)


set start_rng=source_st.


End Sub
thank,

Regards,

C.Mahavishnu
 
Last edited by a moderator:

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
You have declared source_st and pivot_st as Variant, so the compiler doesn't know what properties apply to them - they could be anything. You should declare them as Worksheet objects.
 
Upvote 0
You've declared everything as a Variant so you don't get autocomplete. Change the declarations to be strongly typed e.g.

Code:
Dim source_srt As Worksheet
Dim pivot_st As Worksheet
Dim pt As PivotTable
Dim start_rng As Range
Dim data_rng As Range

WBD
 
Upvote 0
Who's a good boy? :biggrin:
 
Upvote 0

Forum statistics

Threads
1,214,551
Messages
6,120,156
Members
448,948
Latest member
spamiki

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