How To Unlock Vba Code In Excel

0 views
Skip to first unread message

Marie Ota

unread,
Aug 5, 2024, 6:48:11 AM8/5/24
to temdeworlkett
Isthere a way to paste formatted SQL code into a single Excel cell and retain the formatting? If I paste directly into the cell, the code spans multiple rows and keeps formatting but if I try to paste into a single cell by pasting into the format bar, it strips the formatting.

The solution I have is to first get in edit mode of the cell (F2 or double click) and paste the first line followed by "Alt+Enter", paste the second line followed by "Alt+Enter", and so on until you're done.


Hi @SergeiBaklan! Thank you for your response. I am able to paste into the cell. What I am trying to figure out is a way to paste it so that my formatting stays. Here is an example of what I want it to look like in Excel. Currently, I am having to reformat word by word to get the colors I need for the code.


Select the relevant range.

On the home tab of the ribbon, click Conditional Formatting > New Rule...

Select 'Format only cells that contain'.

Leave the first drop down set to 'Cell Value'.

Select 'equal to' from the second drop down.

In the box next to it, enter the formula


That worked as well. Thank you! Here is the toughest portion I face. I've tried to send this to you earlier and hoping it works now. I need a formula to help determine correct capitalization for these fields: E, F, G, and H (Canadian Postal Codes) that will read out TRUE or FALSE in Field J. I have a formula that works for fields E and F but I am unable to develop one that will cover all four fields. I'm attaching this small excel sheet. Hopefully you will be able to see it this time.


Hi:

For that code in the note to work, you have to download the tagset template code in the link, run that to create tagsets.ExcelXP_mod, as shown in the code. When I tried it, tabcolor= suboption worked for me with the modified tagset template, as shown below:


I have this Excel Workbook, with user interfaces in each sheet. Each sheet within the workbook does a different part of some overall task. Should I place the code relevant to each sheet inside the Sheet objects, or in Modules? Group into one module, or separate modules?


Since the tooling is so poor in primitive systems such as Excel VBA, best practices, obsessive code hygiene and religious following of conventions are important, especially if you're trying to do anything remotely complex with it.


This article explains the intended usages of different types of code containers. It doesn't qualify why these distinctions should be made, but I believe most developers trying to develop serious applications on the Excel platform follow them.


There's also a list of VBA coding conventions I've found helpful, although they're not directly related to Excel VBA. Please ignore the crazy naming conventions they have on that site, it's all crazy hungarian.


I would suggest separating your code based on the functionality and purpose specific to each sheet or module. In this manner, you would only put code relative to a sheet's UI inside the sheet's module and only put code related to modules in respective modules. Also, use separate modules to encapsulate code that is shared or reused among several different sheets.


For example, let's say you multiple sheets that are responsible for displaying data from a database in a special way. What kinds of functionality do we have in this situation? We have functionality related to each specific sheet, tasks related to getting data from the database, and tasks related to populating a sheet with data. In this case, I might start with a module for the data access, a module for populating a sheet with data, and within each sheet I'd have code for accessing code in those modules.


In Excel 2016 3D maps, certain New York City ZIP codes are missing. Two examples are ZIP codes 10024 and 10014. That is, when I try to get these regions outlined, they appear blank, while most ZIP codes in New York City appear correctly. However, when I change the visualization to something else, such as "bubble", a bubble is plotted in the correct place, so I don't think the problem is with my data.


I have looked everywhere for a solution and can't seem to find it. I am trying to use 3d maps and it will not take my data. The data I have is three columns: City, State and Zip and when I try to add data to 3d maps it saids that the "data source reference is not valid" What am I doing wrong? Thanks in advance for your reply.


I'm having a problem with 3D Maps not finding a resolution for a set of several zip codes mainly the problem is with Zip Code with Leading Zero's in Puerto Rico and the US Virgin Islands. I 'm currently working on get the Lat and Lon data for my entire data set to hopefully eliminate the problem global . Overall I had a 95% Mapping Confidence for 13,051 unquie zip codes. Any insights would be appreciated.


I opened your example (zip codes.xlsx), and confirmed that I can see a column on the map for ZIP code 10024. However, when I click on "change the visualization to region", all the ZIP codes are shaded in except for 10024. This is the problem I am having too.


I've put together an example that shows that the problem occurs in less artificial circumstances, but I don't seem to be able to upload attachments to this forum. In any event, your example illustrates the problem pretty well.


Im having the same issue but with zip codes right here in the USA. Specifically 22556 Stafford Virgina, 53142 Kenosha and 53403 Racine Wisconsin. I want to see the Visualization by Region. When I have this set by County the whole area is colored, but as you can see from the picture, when it goes to zip codes I have holes in my map. I've tried deleteing and re-adding the data, doesnt help. HELP has this been fixed yet?!?!


It seems that your script is timing out. It's difficult to say exactly why without knowing what your script looks like and what the workbook it is running on looks like. For assistance, I'd recommend making a new post with a full repro containing a copy of your script and the workbook it is running on for more help from the wider community as well (you can tag me there too).


We do not have a certificate issue or know of an outage currently. It seems that your issue is that your script file was corrupted somehow. The .osts file corresponding to your script does not seem to be valid JSON. You can try to fix that file manually, or just create a new identical script and that should fix your issue.


It looks like you are having the same issue as above. Your script seems to be in an invalid state. We usually see this happen when the script file itself was modified manually. Can you recreate the script and try again?


Still have the issue here : Failed to retrieve dynamic inputs. Error details: 'The dynamic operation request to API 'excelonlinebusiness' operation 'GetSingleScriptV2' failed with status code 'BadGateway'. Error response: error: code: 502, source: europe-001.azure-apim.net, clientRequestId: fadb4ced-a006-4d34-8ea7-5a9cd39c86dc, message: BadGateway, innerError: status: 502, message: he server experienced an issue and couldn't complete the request. Please try again in a few moments.clientRequestId: fadb4ced-a006-4d34-8ea7-5a9cd39c86dc messag: The server experienced an issue and couldn't complete the request. Please try again in a few moments.


Hello,

I think I might encountered the same issue. I am trying to test if office scripts work for me. First of all, the action asks me for a script parameter field, which I did not specify in my script and in the course of the topic - BadGateway



Also this excel workbook should contain scripts inside itself, but from "Run office script" action it is not seen (maybe it could be a part of the same retrieval action)


The idea is that I'm starting to learn how to make UDFs, and do various things in VBA, and thought that if I could see how Excel actually executes Sum() for instance, I can learn how to make my code tighter, take less space, etc.


Inside the archive, look into file aoo-4.1.2\main\sc\source\core\tool\interpr4.cxx

and there around line 3500 you can find long case statement showing internal function calls for built-in spreadsheet functions. This is your starting point.


I would instead, urge you do understand the logic of the functions. You know what a Sum is, that should be easy for you to replicate. The things you don't know - like a vlookup or stdev have some sort of logic - whether purely mathematical or operational (like transpose). Learn how those work and then design your code around the logic.


If the latter, you can use the data cleansing. At the top there are selections to remove columns and rows that are completely null. Keep in mind this will only work if the values are null, not empty. I added a multifield tool to change any instance of empty to null prior to catch everything.


Unfortunately, the library excel.link will not allow you to load empty columns (aka columns with no names). As per package documentation "Orphaned rows/columns located apart from the main data will be ignored." (source: -project.org/web/packages/excel.link/excel.link.pdf, page 22).


As mentioned previously, you may need to run Designer as Administrator to install any Python modules if you have an Admin version of Alteryx Designer. This would be only required during the installation.


Office Scripts are written in either TypeScript or JavaScript and use the Office Scripts JavaScript APIs to interact with an Excel workbook. The Code Editor is based on Visual Studio Code, so if you've used that environment before, you'll feel right at home.


Office Scripts are written in TypeScript, which is a superset of JavaScript. The Action Recorder generates code in TypeScript and the Office Scripts documentation uses TypeScript. Since TypeScript is a superset of JavaScript, any scripting code that you write in JavaScript will work just fine.

3a8082e126
Reply all
Reply to author
Forward
0 new messages