VBA Site contains VBA code to create macros in WORD EXCEL ACCESS OUTLOOK

 

Classes

 

Code to be placed in module

 

Sub xClass()

Dim cell1 As New MyClass

cell1.r = 1 ' r = row number

cell1.c = 1 ' c = col number

cell1.v = "a" ' v = value

cell1.iinput

Dim cell2 As New MyClass

cell2.r = 2

cell2.c = 2

cell2.v = "b"

cell2.iinput

End Sub

 

Code to be placed in class module

 

Private cr As Integer

Private cc As Integer

Private cv As String

Public Property Let r(mr As Integer) ' data is remembered for the object

cr = mr

End Property

Public Property Get r() As Integer ' data is taken for the object

r = cr

End Property

Public Property Let c(mc As Integer)

cc = mc

End Property

Public Property Get c() As Integer

c = cc

End Property

Public Property Let v(mv As String)

cv = mv

End Property

Public Property Get v() As String

v = cv

End Property

Public Sub iinput()

Cells(r, c).Value = v

End Sub



Dodaj komentarz






Dodaj

© 2013-2024 PRV.pl
Strona została stworzona kreatorem stron w serwisie PRV.pl