clearing a variable defined by Type statement

diddi

Well-known Member
Joined
May 20, 2004
Messages
2,890
Office Version
  1. 2010
Platform
  1. Windows
hi and easter greets to all. i have set up a number of variables using the Type structure which i use for getting and putting data to Random files. eg a variable called Payment to record customer payment info such as date and payment method etc.

Code:
Type Payment
    D As Date
    cn As Integer
    Pay As Single
    Meth As Integer
    Chq As Long
    ReMare As Integer
End Type

is there a simple way to clear all values in the variable or do i have to do this?
Code:
Payment.Date=0
Payment.cn =0
Payment.Pay =0
Payment.Meth =0
Payment.Chq =0
Payment.ReMare =0


thx
 

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Zack Barresse

MrExcel MVP
Joined
Dec 9, 2003
Messages
10,881
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
  3. Web
Nope, you've got to set them all manually. Not sure why you'd go with a Type declaration though. They're not very user friendly IMHO. Plus they're static and only called at run time. It would seem that a class would be better. Why don't you take a read here for some good information....

http://www.cpearson.com/excel/Classes.aspx

HTH
 

diddi

Well-known Member
Joined
May 20, 2004
Messages
2,890
Office Version
  1. 2010
Platform
  1. Windows
that link looks like the perfect solution. thx Zack
i'll do some homework!
 

Watch MrExcel Video

Forum statistics

Threads
1,122,712
Messages
5,597,720
Members
414,168
Latest member
Manapo

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
Top