VBA beginners questions

smart_beta

New Member
Joined
May 16, 2020
Messages
10
Office Version
  1. 2019
Platform
  1. Windows
Hi - why doesn't the following syntax work?

I'm inside the VBA editors and have typed the following

? 1 + 1

result: should be 2
what I get is:

Print 1 + 1

also:

I type:
? application.name
and the results I get is Print application.name, when I should get "Microsoft Excel"

and finally,

in sheet1 cell A1 I have the string " hello world"

I type this in the editor:
? worksheets(1).Range("A1"). value = "hahaha" and hit enter
and I get this and nothing happens:

Print Worksheets(1).Range("A1").Value = "hahaha"

What is going on? Thank you!
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Use ? in the immediate window (CTRL+G in VBA editor), inside sub/function use Debug.print
 
Upvote 0
Solution
OK!!! the problem was I needed to be in the "Immediate window" not the general editor.

what's the difference anyway?
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,687
Members
449,117
Latest member
Aaagu

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