Posts

Showing posts from June, 2023

Column Autofit in Excel using macro

Image
 Hello dudes! Did you ever feel irritated by resizing each column in Excel?👀 Don't worry this post is to solve your problem! Yess this post is about "How to enable column auto-resizing feature in excel using a single line macro (VBA)" Language : VBA  Before resizing Size of column is not consistent with text Whenever the above problem arises we will be manually adjusting the column right? . But hereafter it wont be the case! Steps to enable column autofit feature: Step 1: - Right click on sheet name and select View Code Step 2 : - After getting this window click on the drop-down menu and select Worksheet (which means this code is applicable only for this specific sheet) - First and last line of the code will be generated automatically , so our work is to type " Cells.EntireColumn.Autofit " - Click on to excel icon on left corner (which brings you back to sheets) - Haan Done! - This code not only resize the columns as per existing data, but the resizing operat

Number Guessing Game

Image
 Hello Dudes!  Hope you all are doing well 😀  Today we gonna see a python code for " Number Guessing Game"! . In short, in this game python will choose a random number within the given range and you are required to guess the number. Don't worry, until you choose the right one it will help you with some comments 😉. Language : Python IDE : Pycharm  Code : - "random" module is imported (with which random number can be generated within the given range). - An user defined function named "number_guessing_game" is created  - Two variables are created   1) number -In this variable randomly generated number is stored  2) guess - The number which you guess will be stored here . Initially this variable is assigned with null. - The logic behind while loop is : until you guess the correct number it will ask you to guess. - The logic behind if condition is : if guessed value is lower than the generated value then the comment " Your guess is too low"