VBA Run-Time Error 438

Bwolosz

New Member
Joined
Jul 10, 2019
Messages
6
Hi Everyone,

I am trying to learn the basics of VBA to automate basic repetitive work tasks.

When attempting to declare variables and use them I keep getting a runtime error 438.
I am sure this is a vary basic format error, but I have not found any support on how to resolve the issue.

Any help is greatly appreciated.

Code Snipit: Applied to Sheet1 in VBA module

Public Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Test1 As Long
Dim Test2 As Long


Test1 = Range("D3").Vaule <---- Debugger shows the error on this line
Test2 = Test1 + 30


Range("E12").Vaule = Test2


End Sub

Thanks,

Bradley Wolosz
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hi & welcome to MrExcel
You have spelt Value wrongly
 
Last edited:
Upvote 0
Hi Everyone,

I am trying to learn the basics of VBA to automate basic repetitive work tasks.

When attempting to declare variables and use them I keep getting a runtime error 438.
I am sure this is a vary basic format error, but I have not found any support on how to resolve the issue.

Any help is greatly appreciated.

Code Snipit: Applied to Sheet1 in VBA module

Public Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Test1 As Long
Dim Test2 As Long


Test1 = Range("D3").Vaule <---- Debugger shows the error on this line
Test2 = Test1 + 30


Range("E12").Vaule = Test2


End Sub

Thanks,

Bradley Wolosz
If that's not just a typo in your post, try changing it to Value and ensure that D3 and E12 contain numbers.
 
Upvote 0
See if this works better. If so I may be able to clarify...

Code:
Public Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Test1 As Long, Test2 As Long
    Test1 = CLng(Range("D3")
    Test2 = Test1 + 30
    Range("E12") = Test2
End Sub

Also, could you post the value of Range "D3"?
 
Last edited by a moderator:
Upvote 0
**** LMAO,

Chalk it up to fat fingers, or maybe a little typing Dyslexia but that would be the issue.

Sometimes it is the stupid stuff that kicks me in the butt!

Thanks showing me the error that I should have seen on my own!
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0
**** LMAO,

Chalk it up to fat fingers, or maybe a little typing Dyslexia but that would be the issue.

Sometimes it is the stupid stuff that kicks me in the butt!

Thanks showing me the error that I should have seen on my own!


The part you will love the most is that the .value isnt technically even needed. You could have deleted that entirely to fix your code. :)
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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