Thread: Moving a number
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
programmernovice[_2_] programmernovice[_2_] is offline
external usenet poster
 
Posts: 61
Default Moving a number

On Wednesday, November 11, 2020 at 3:26:24 PM UTC-6, Auric__ wrote:
programmernovice wrote:

On Tuesday, November 10, 2020 at 11:12:00 PM UTC-6, Auric__ wrote:

[snip]
(In VBA, an underscore ("_") by itself at the end of a line is a line-
continuation character.)

Oops. I had used one of these in the example code I first wrote, then found a
way to make it all on one line, but forgot to delete this.
Many thanks, Auric, for the excellent, thorough explanation. Do you
have an opinion on a good beginners VBA book?

I don't, sorry. I learned Visual Basic in the mid-90's using one of those "in
24 hours"-type books, and haven't really needed one since then. (Of course,
it helped that I had been using other forms of BASIC since the early 80's.)

Microsoft Press has what they call a "VBA Primer" he

https://www.microsoftpressstore.com/...aspx?p=2224365

It's 5 pages of the basics (no pun intended), but doesn't get you very far
along the process.

They have 2 books, "Microsoft Excel 2019 VBA and Macros" (watch the
wordwrap):

https://www.microsoftpressstore.com/...-2019-vba-and-
macros-9781509306114

...and "Microsoft Excel 2019 Inside Out" (again, wordwrap):

https://www.microsoftpressstore.com/...19-inside-out-
9781509307692

Those *might* be somewhat helpful, but neither one is specifically a
beginning-to-end guide to VBA.

--
- Nothing personal, but I hate doctors.
- It's cool, most of us hate some of our patients.



Thanks again, Auric. I will look into your suggestions for books.

I tried your suggested syntax for moving a number into a different sheet. My statement is:

Range("M12").Value = Sheets("stocks").Range("c2").Value

"M12" refers to the active sheet. "Stocks" is another open sheet. Cell "C2" contains a number. When I run it, I get the error message

Run-time error '9'
Subscript out of range.

What am I doing wrong. Many thanks for your patience!