Monday, April 21, 2014
Best Wishes over the Holiday Season
I had a wonderful time getting together with my family in Boston for the holidays. The only minor disappointment was we spent a few days in Vermont and there was literally no snow - so no skiing unfortunately.
I am pretty excited. I got a MAC laptop for Christmas and feel like I am back in kindergarten learning how to scroll and select data. I also got the Mac version of Office so that should be interesting. I will let you know how this goes.
The Mac laptop has some great features that I am looking forward to playing with. Luckily I have my daughter as the resident Mac guru. It seems that with this I am reverting back to shortcut keys to do everything. The command key is constantly in use. When I tweeted about my laptop and commented about learning how to right-click, I had a couple of people tweet me back to see how to do it.
To right-click on a Mac laptop, put two fingers - your index and forefinger -slightly apart on the track pad area and then press down with your forefinger.
Year End is almost upon us. Yikes! Enjoy the rest of the week.
Sunday, April 20, 2014
How to get Author details from Track Changes using VBA
If you want to know the details of track revisions, for example, Author name etc the following code will help you:
Sub Get_TrackRevision_Author()
Dim oRev As Revision
Dim oRange As Range
-----------------------------------------------------------
Change the line below to suit your needs
-----------------------------------------------------------
Set oRange = Selection.Range
-----------------------------------------------------------
Coded by Shasur for http://.blogspot.com
-----------------------------------------------------------
For Each oRev In oRange.Revisions
MsgBox oRev.Range.Text & " " & oRev.Author
Next oRev
End Sub
The following code provides you more information (like if the comment is inserted / deleted)
If oRev.Type = wdRevisionDelete Then
MsgBox oRev.Range.Text & " deleted by " & oRev.Author
ElseIf oRev.Type = wdRevisionInsert Then
MsgBox oRev.Range.Text & " added by " & oRev.Author
Else
MsgBox oRev.Range.Text & " " & oRev.Author
End If
If you want to know Date of Revision using VBA then the following can be added
MsgBox oRev.Range.Text & " " & oRev.Author & " " & oRev.Date
Saturday, April 19, 2014
Excel Tip Range Names
Range Names as Absolutes
I decided to talk about Range Names today since my blog of yesterday was on absolute cell references. Whenever you name a cell, Excel treats it as an absolute cell reference. So, lets talk about this a bit and see why it can be extremely useful to give a cell or a range of cells a name.
- First, you can use range names in formulas. =Sum(expenses) is a lot more explanatory as well as easier to remember than =sum(F15.F36). This can be very useful in those budget spreadsheets that you use a couple of times a year and have trouble remembering what things are.
- You can use range names to navigate around a workbook as a range name can only be used once in a book. Select the range name and Excel will automatically hop you over to the cell or range of cells that you named - even if they are on a different sheet.
- You can use a range name in a print area so if you are printing different sections of the same file every month it would be easier to remember a range name than cell references.
Okay- you get the idea. I personally like to use range names in Vlookups and other functions where I need to refer to a table - particularly if I am going to copy that function down. Why? Because range names are absolute cell references and if I incorporate the range name into the Vlookup, I dont have to worry about making sure that the cell references are absolutes cell references - it does it automatically!! Honest....
So, now that I have convinced you of your need to know about range names, let me tell you how to create one. There are a couple of ways but this works in all Excel versions and frankly it is the easiest way to do it so I wont bore you with the other ways.
- Select the cell or range of cells that you want to name.
- Click the Name box, located at the left end of the formula bar, just above Column A .
- Type in the name that you want to use.
- Press the ENTER key.
I told you it was easy!
Okay.. now for the rules...
Names can be up to 255 characters but most people keep them very short so that it is easy to remember and easy to type.
Range names cannot begin with a number ( 2008 Sales is wont work but Y2008_Sales would )
Range names cannot contain any spaces. (You can use underscores though)
- Careful- in Excel 2007, some range names such as Tax08 won’t be valid range names as it is considered a cell address due to the size of the 2007 Excel spreadsheet!
Okay- last thing... if you want to select the Range Name simply click the drop down arrow beside the Name box.
If you want to see the range names or use them in a formula, click the F3 key to provide a list of them. (In Excel 2007, you can also use the Name Manager found on the Formula Ribbon).
Friday, April 18, 2014
Using SUMPRODUCT to count
Lets look at the example below,
In column C dates and column D the error happened on the day with possible multiple entries.
Love to have your comments....
Thursday, April 17, 2014
The remote server returned an error 407 Proxy Authentication Required
- Imports System.Configuration
- Imports System.IO
- Imports System.Net
- Imports System.Text
- Public Class Form1
- Dim InstallerSite As String
- Dim UploadFile As String
- Dim MyProxy As New WebProxy
- Dim ProxyPresent As Boolean
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- InitializeGlobals()
- txtResult.Text = GetFile()
- End Sub
- Private Sub InitializeGlobals()
- InstallerSite = CType(ConfigurationManager.AppSettings("InstallerSite"), String)
- UploadFile = CType(ConfigurationManager.AppSettings("UploadFile"), String)
- ' Case for when a Proxy is present.
- ProxyPresent = CType(ConfigurationManager.AppSettings("ProxyPresent"), Boolean)
- Dim ProxyUrl As String = CType(ConfigurationManager.AppSettings("ProxyUrl"), String)
- Dim ProxyDomain As String = CType(ConfigurationManager.AppSettings("ProxyDomain"), String)
- Dim ProxyUserName As String = CType(ConfigurationManager.AppSettings("ProxyUserName"), String)
- Dim ProxyPassword As String = CType(ConfigurationManager.AppSettings("ProxyPassword"), String)
- Dim credentials As New System.Net.NetworkCredential(ProxyUserName, ProxyPassword, ProxyDomain)
- MyProxy.Address = New Uri(ProxyUrl)
- MyProxy.Credentials = credentials
- End Sub
- Private Function GetFile() As String
- Dim result As String = String.Empty
- Try
- Dim request As HttpWebRequest
- Dim response As HttpWebResponse
- request = WebRequest.Create(InstallerSite & UploadFile)
- If ProxyPresent = True Then
- request.Proxy = MyProxy
- End If
- response = request.GetResponse()
- Dim responseStream As Stream = response.GetResponseStream()
- Dim buffer(10) As Byte
- Dim bytesToRead As Integer = CInt(buffer.Length)
- Dim bytesRead As Integer = 0
- While bytesToRead > 0
- Dim i As Integer = responseStream.Read(buffer, bytesRead, bytesToRead)
- If i = 0 Then
- Exit While
- End If
- bytesRead += i
- bytesToRead -= i
- End While
- result = Encoding.ASCII.GetChars(buffer)
- Catch ex As Exception
- result = ex.Message
- End Try
- Return result
- End Function
- End Class
It turned out they needed to enter the IP address for their proxy domain not just the domain name.
Sort Columns of the Table using Word VBA
Sort Word Table columns using Word VBA
The following function uses Selection.Sort, you can try alternative methods if selection is not possible / permissible
Function SortTable()
ActiveDocument.Tables(1).Select()
Selection.Sort(ExcludeHeader:=True, FieldNumber:="Column 1", SortFieldType _
:=wdSortFieldAlphanumeric, SortOrder:=wdSortOrderAscending, FieldNumber2 _
:="", SortFieldType2:=wdSortFieldAlphanumeric, SortOrder2:= _
wdSortOrderAscending, FieldNumber3:="", SortFieldType3:= _
wdSortFieldAlphanumeric, SortOrder3:=wdSortOrderAscending, Separator:= _
wdSortSeparateByTabs, SortColumn:=False, CaseSensitive:=False, LanguageID _
:=wdEnglishUS)
Selection.MoveRight(Unit:=wdCharacter, Count:=1)
End Function
The above uses as three column table. Please customize it for your use
See also:
How to use .Net Array.Sort Function in VBA
Case in-sensitive comparison
Tuesday, April 15, 2014
Move Site between WordPress Blogger
You Should Know -
- All of your posts will be moved with comments and images.
- No data will be deleted from your current site unless you delete it.
- You can back up your site as XML file.
- Images will be stored by server URL.
- However you will lose your SEO score or rank.
The transfer procedure is almost similar both in Blogger and WordPress.
Blogger to WordPress
This is the most common situation. Most of the new bloggers start writing on Blogger. When they need more resources, they shift their sites to WordPress. In fact, when a blogger becomes professional, he usually moves the site to WordPress.
If you would like to move your site from Blogger to WordPress, then youve to back up your site first. Then upload the file to your WordPress site. Follow the steps below:
Back up your Blogger Site
- Sign in to your blogger account and go to the dashboard or control panel.
- Choose the settings option from the left pane and select other.
- Now hit on the Export Blog button from Blog Tools.
- Download Blog > Save it as XML Document in your hard disk.
- This URL- http://.wordpress.com/wp-admin - will give you the direct access to your sites dashboard. Just replace the word with yours.
- From the left pane, go to Tools > Import > Blogger. Or you can directly go there - http://.wordpress.com/wp-admin/admin.php?import=blogger - Just replce the word .
- Now hit on the Choose File button and select the XML file that youve stored earlier.
- Now hit on the Upload File and Import. Import procedure will be started. This may take some time.
- Go to the WordPress Control Panel - http://yoursite.wordpress.com/wp-admin
- Then go to Tools > Export > Export Option > Export > Choose What to Export > All Content > Download Export File > Save as XML Document > Done!
Store the file in your hard disk to upload anywhere in the futuer.
- Go to Blogger Dashboard/ Control Panel.
- Go to Settings > Other > Blog Tools > Import Blog > Choose File > Select WordPress XML Document > Type Captcha properly > Import Blog > Done!
Even if you dont move your site, always back it up at a regular interval. Any time you may lose your email account which is associated with your site. And thus your site could be hacked! So back up your site at least once in a quarter. So that you can restore it in a new site.
Stay with Marks PC Solution to get more interesting IT topics!
Constants fixed length strings arrays user defined types and Declare statements not allowed as Public members of object modules
Declare Function apiFindWindow Lib "User32" Alias "FindWindowA" _
(ByVal lpclassname As Any, ByVal lpCaption As Any) As Long
DLL procedures declared in standard modules are public by default and can
be called from anywhere in your application. DLL procedures declared in any
other type of module are private to that module, and you must identify them
as such by preceding the declaration with the Private keyword. Hence
Private Declare Function apiFindWindow Lib "User32" Alias "FindWindowA" _
(ByVal lpclassname As Any, ByVal lpCaption As Any) As Long
Should solve the problem
Monday, April 14, 2014
Add Control To PopupMenu
Use this function to add the control to the popup menu
Function Add_Control_To_PopupMenu(ByVal sControlName As String, ByVal sMacroName As String)
On Error GoTo DisplayErr
Dim ctlCB As CommandBar
Dim ctlMenu As CommandBarControl
Dim ctlCommand As CommandBarControl
Set ctlCB = Application.CommandBars("Cell")
If ctlCB Is Nothing Then Exit Function
Set ctlCommand = ctlCB.Controls.Add
ctlCommand.Caption = sControlName
ctlCommand.OnAction = sMacroName
DisplayErr:
If Err <> 0 Then
MsgBox Err.Description
Err.Clear
End If
Creating Custom Office Menus and Toolbars, Programming Microsoft Office Command Bars, CommandBars Property, Creating an Excel Add-in, Disable command bars and controls, Change the availability for the CommandBars using VBA, Delete/ hide a custom command bar
End Function
Sub Call_Add_Control_To_PopupMenu()
---------------------------------------------------------------
Written By Shanmuga Sundara Raman for http://.blogspot.com
---------------------------------------------------------------
Add_Control_To_PopupMenu "Sample", "Donot_Fire_Events"
End Sub
Add a new menu item to the Popup menu, Adding Menu Items, Add Command to Popup menu, , Dynamic Addition of command to Popup menu. Adding Command Button to Popup, Adding to Popup menu
Maximum Limit of Rows Columns etc in Excel
If you have worked on a large set of data from a non-Excel data source, for example, MS ACCESS, there are chances that you would have stored that in multiple sheets.
This riducules the data management. Now in Excel 2007 and above you have a big Excel workbook with 16384 columns and 10,48,576 rows
Following table gives you how big Excel has grown :)
Excel 2003 | Excel 2007 and above | |
Maximum No of Rows | 65,536 | 10,48,576 |
Maximum No of Columns | 256 | 16,384 |
Sunday, April 13, 2014
How to increase your laptop batterys life
Follow the few steps to increase the laptop batterys life:
Lower the backlighting on your screen.
The screen of your Laptop takes up significant amount of power and you do not require its maximum brightness. You should have to check your system and decrease the screen brightness it to a comfortable point.
Stop your wireless signal when you are not using.
After turning off your Laptop can save max. 20 minutes of your laptops battery time because WiFi can use a considerable quantity of power. By right clicking you can stop your WiFi signal when you are not using.
Manage the correct power scheme in XP
Windows XP contain a number of predetermined power plans, which control settings like how rapidly your laptop turns off and when your screen saver boots in. You can change your laptop power scheme by choosing Control Panel > Power Options. For max. Battery life from the "Power scheme" chooses the option "Max. Battery" and decline the list. There are good choices for you just like "Low Power Mode" and Portable /Laptop. They dont conserve as much power as Max Battery. After selecting a power scheme you click Ok button to finish the process.
How to Convert Decimal to Hexadecimal using VBA
How to Convert Decimal to Octal using VBA
Sub Get_Hex_n_OCt_Values()
For i = 0 To 255
Debug.Print i & vbTab & Hex(i) & vbTab & Oct(i)
Next i
End Sub
VBA Decimal to Hexadecimal Conversion
Saturday, April 12, 2014
Excel Pivot Tables
Friday, April 11, 2014
How to avoid BLANKS errors in CHARTS
Prerequisite
Possible Usage
For example, refer to the table below.
The steps (How to do)
2. Drag or Copy/Paste all the necessary cells
DONE
How to Measure the Rank of a Website
The ranking of a website depends on several factors. It depends on Google Page Rank (known as PR), Alexa Traffic Rank, Complete Rank and so many. And to check the ranking status, there are thousands of extension available for internet browsers.
- First, make sure you are using Google Chrome or Firefox.
- If you are a chrome user then click here. And Firefox users can use this link.
- Chrome users will get several toolbars with Web Rank SEO. You can choose either the first one or any other toolbar as you like and then hit on Add to Chrome. And Firefox users should click on Add to Firefox button.
- Then click on install. Firefox should be restarted. But chrome doesnt need to be restarted.
- Now you are almost done. Chrome users must see this like an icon at the upper right corner. And Firefox users will get it like a horizontal bar.
Thursday, April 10, 2014
Evaluating Formulas
Two ways to do the same thing... and yes, if we look around, we will probably find a 3rd method too. Have a good day.
Tuesday, April 1, 2014
Smashing your PC only way to prevent data theft by fraudsters
Thu, Jan 8 02:10 PM
London, Jan 8 (ANI): The safest way to stop fraudsters stealing information from old computer hard drives is to "destroy the PC with a hammer", a consumer magazine has said.
The computing magazine Which? recovered 22,000 "deleted" files from eight computers purchased on eBay.
They then used specialist software to recover files that the original owner had deleted, reports the Daily Express.
Sarah Kidner, editor of Which? Computing, warned that the risk of becoming a victim was increasing.
"Even if you delete your files, youd be surprised how easy it is to recover your personal data. Such information could bring identity thieves a hefty payday.
"It sounds extreme, but the only way to be 100 percent safe is to smash your hard drive into smithereens," she said. (ANI)
Firefox 3 Its Almost Ready
From what I can see, it looks like the final version of Firefox 3 will be released very soon. On April 2, 2008 (just this past Wednesday), Firefox 3 Beta 5 was released and it sounds like it will be the last one before the full version makes its debut. Of course, the beta versions are meant for testing purposes only, but with five betas under their belt, it looks as if Mozilla is almost ready for the launch. According to a Reuters report, "Mozillas development team has deemed the newest version of their very popular browser all but fit for mass consumption." Sounds promising to me!
Although a final release date has not been scheduled yet, there are rumors going around that the full version should be ready sometime in the second quarter of 2008. Mozilla just needs a little more time for further testing and to perfect it for all of you avid users out there. It sounds like the Beta 5 will focus mostly on the visual aspects of the browser, as well as, stability and security. So, dont fret! Firefox 3 is almost ready and it will be here soon. And I promise, it will be well worth your wait!