Skip to main content

Posts

Showing posts with the label Word

Excel VBA set worksheet visibility

Set excel worksheet visibility by changing its property.
Simple and a one liner code to hide and unhide worksheet in Excel.
Sub Visible_Sheet()
Worksheets(1).Visible = 1  'Make the worksheet visible
End Sub
Sub Hide_RightClick_Unhide()
Worksheets(1).Visible = 0    'Hide Worksheet to Unhide Right click on Sheet name and unhide the worksheet
End Sub
Sub Super_Hide()
Worksheets("calcx").Visible = 2
 'Hide Worksheet but right click on Sheet name will not show whether the sheet is hidden or not
End Sub



Cheers! Till next time.

================================ Free Android Apps:
Click on links below to find out more:

Excel Keyboard shortcuts guide https://play.google.com/store/apps/details?id=chrisjoms.myexcelapplicationguide
Linux Android App cheat sheet: https://play.google.com/store/apps/details?id=com.LinuxMobileKit
Multiplication Table for early learners https://play.google.com/store/apps/details?id=com.TableMultiplication
Catholic Rosary Guide  for Android:
https://play.google.com/sto…

Excel find last row with value in a specific column

1. How to find last row with value using vba in a specific column?

2. How to find last row with value  using vba in a worksheet?

The questions above are entirely two different scenarios.

The first question will find the last row with value in a specific column within the worksheet.

While the second question find the last row with value of the entire worksheet.

The first question is applicable if you need to find the last row in different columns.

Let's say Column 1 or Column A, or Column 2 or Column B etc.

Example code below will find the last row in a specific column via VBA code.

===================
'command Cells(Rows.Count, 1) = find the last row with value in Column 1 for Sheet3

Dim last_row As Integer

last_row = Worksheets("sheet3").Cells(Rows.Count, 1).End(xlUp).Row

Msgbox last_row

'replace 1 with the desired column 
'ex: command Cells(Rows.Count, 7) = find the last row with value in Column 7
===================

If you don't need to specify a worksheet or…

How to insert landscape orientation in Word?

If you are writing a thesis, a report or an article that you need to insert a landscape layout in a specific page in Word document but your orientation all long is portrait and changing the orientation causes the whole layout to change.
Inserting landscape in a specific page in a word document can be done by inserting section breaks. Let’s just make a basic example.
Let’s say you have 3 page document and you want that first page in Portrait mode, second page in landscape and third page in portrait layout also.
First, click on “home” tab, click the “show/hide paragraph marks” option or see the icon below. Enabling this option the section breaks, spaces and tabs will be visible. But what we are interested is to see the “section breaks”.


In the first page position the cursor on the last area at the bottom of the page.
In Word 2010, click on “page layout” in the ribbon tab. Click on “breaks” and select “next page”. In the second page, position also the cursor at the middle or bottom of t…

Outlook does not display picture

Have you received an email saying please find the picture below, but the picture is on the attachment not on the body of email.

Or sending out a nice an beautiful layout of graphics hoping to impress a colleague or client only to find out that the the graphics doesn't display correctly in Outlook or either in the mobile phone.

HTML Tables has been a big help for web designers or developers before the CSS era or other good platforms at this time.

Well, if picture is not displaying properly in Outlook or mobile phone. Embedding or inserting the picture in a Table, seems to be a good quick solution in inserting pictures via Outlook and it will display properly in mobile phone also.

When composing email in Outlook, click on the Insert option and click on insert table. If sending two pictures, you can insert a two rows or two columns and insert the picture on each row or column.

After sending out the email, check the email in Outlook or mobile phone and if everything goes okay the pic…

Word VBA Select Page

How to select a page in Word VBA?

Sub Select_Home()

'Select the first page of the document (page 1)
'Like pressing Ctrl + Home

Selection.GoTo wdGoToBookmark, , , "\StartOfDoc"


End Sub

Sub Select_document_end()

'Select the end of the document
'Like pressing "Ctrl+End"

Selection.GoTo wdGoToBookmark, , , "\EndOfDoc"

End Sub

Sub Select_via_Page_Number()

'specify the page number
'Example below will select page 5

Selection.GoTo wdGoToBookmark, , , "5"

End Sub

Tested and working using Word 2010.

Cheers..till next time :) Happy coding.

================================
Free Android Apps:

Click on links below to find out more:

Linux Android App cheat sheet:
https://play.google.com/store/apps/details?id=com.LinuxMobileKit


https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer

Catholic Rosary Guide  for Android:

https://play.google.com/store/apps/details?id=com.myrosaryapp

http://quickbytesstuff.blogspot.sg/2014/09/how-to-r…

Word calculate values in table

Microsoft word uses basic formula calculation such as getting sum values, counting the number of rows in a table, product calculation, taking average values and some other functions which can be easily use from the drop down function of the formula.
Word is not a spreadsheet so calculation formulas are limited; of course Excel is the suited tool if the task requires more extensive calculation.
Below is a screen shot on how to use Microsoft Word formula to access basic function for calculation.
From the ribbon tab, insert a Table then click on “Table Tools”, click on “Layout” and select formula from the options.
If there is no Table inserted in Word. “Table Tools” will not be visible and also the formula functions.

See screen shot below:



Cheers.. till next time..

Excel formula does not recalculate automatically

Formulas in a worksheet do not automatically recalculate.
By default formula recalculation in Excel is set to automatic but if it has been changed to manual you can set it back to auto.
To set the calculation to auto or manual, click on the “Formula” tab then in the right had corner click on “Calculation options” and select the desired option.

See screen shot below:


GIMP start a new path or selection

Start a new path when creating lines in GIMP.
How to create lines in GIMP?
Select the pencil tool from the toolbox, make sure the foreground color is not the same with the background color or else the line will be invisible.
If you need to specify a brush select the "brush" that you want to use to create the line.
Press and hold the "shift key" then select or click the start point.
Click the second point (while still holding the shift key) and a line will be drawn. Release the "shift key".
If you want to draw again a new line, press "shift key" but you will notice that the line will be connected to the last point that the line was drawn.
This will happen if you didn't "double click" on the last point that the line was drawn.
Even if you press "esc" key it will still continue from the old point or the new line is still connected to the end of the line that was previously drawn. Or if you’re doing a selection the new area…

Excel VBA replace first or last character

Excel VBA code below will replace the first or last character of the cell value.

Use a test workbook with dummy data, to test the VBA code.

Works fine on Excel 2010.

Sub replaceChar()
'Replace Last Character

Dim i, ilength As Integer
Dim strCellValue, yCutString, zValue As String
Dim iRow, myColumn As Long

'specify the column where the values will be changed
myColumn = 2

'get the last row
iRow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row

For i = 1 To iRow
On Error Resume Next

strCellValue = Cells(i, myColumn).Value
ilength = Len(strCellValue) - 1

'left - will replace last character on the string
yCutString = Left(strCellValue, ilength)

' LastChar is the string that will be added to the end of the cell value
'Replace this with any desired value
zValue = yCutString + "LastChar"

'Display the value of the processed string
'press ctrl+break to stop the loop
MsgBox zValue


'uncomment this line to replace the value with the processed string
'specify…