Calc does not speak Excelian. There are some cases where you can get a module from Excel-VBA to work in Calc if you add a line
Option VBAsupport 1 above all he other lines of code. And code exclusively doing calculations without any direct access to objects will mostly work, but …
In LibreOffice BASIC is only one of the languages usable for added code, and therefor only very few objects and methods are directly introduced to BASIC as named entities. All the rest is done via interfaces and services which can also be accessed by a different programming system if a respective bridge is supplied.
A few remarks:
ThisComponent.Sheets("12") is not the sheet with the name “12”. (BTW: Don’t use numbers as names.) The Sheets() property of the spreadsheet document expects a number enclosed between the parentheses for the shortcut access to a sheet. If there is one, ok. If there is a string an automatic conversion is attempted. In your case it is successful and the sheet with the internal number 12 is returned. Internal numbers of indexed properties start, however, with 0 in Calc. Therefor you get the 13th sheet in the order from left to right speaking of the tabs independent of the name.
You may use ThisComponent.Sheets.GetByName(“12”) to get what you wanted.
To activate a different sheet apart from VBAsupport you need to call the method
SetActiveSheet() of the object
Of course this may sound strange to you - and in fact the concept of interface-oriented programming needs approaches you will not be familiar with.
Therefor: Start using Calc without any “macros” (or only with very few simple ones). From my point of view the continued encouragement to use macros with Excel is mainly a means to aggravate compatibility and a strategy to enforce user lock-in. Spreadsheets should work as spreadsheets: Find a new equilibrium based on formulas if some content was changed. Don’t push contents elsewhere, but reference them from where you need them. If you actually want to use “input boxes”: I rarely had use for these toys, but if I wanted one I simply used a ‘Formatted Field’ or a ‘Text Box’ control which both have a property ‘Linked Cell’ and to the cell given there by its address the entered value goes. No macro needed!
If you insist on learning how to pprogram for Calc in BASIC, start with the guide and with the famous documents by Andrew Pitonyak.