Pages

Monday, April 21, 2014

Best Wishes over the Holiday Season

I hope everyone had a great Christmas, Hanukkah or whatever holiday you celebrate. It is a great time to get together with your family and other people who are important to you and to remember the reason why we are all here.

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.
Read more »

Sunday, April 20, 2014

How to get Author details from Track Changes using VBA

Word VBA - extract Revision Author information

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
Read more »

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.


  1. Select the cell or range of cells that you want to name.

  2. Click the Name box, located at the left end of the formula bar, just above Column A .

  3. Type in the name that you want to use.

  4. 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).

Read more »

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.

”how



The requirement is to calculate the number of times error5 occurred after 5/5/2012 and before 5/15/2012. (answer is 5).

”how


Lets put the two dates in A1 and A2. The formula will be 
=SUMPRODUCT((C1:C22>A1)*(C1:C22<A2)*(D1:D22="error5"))


If you do not want enter dates in cells the formula will be 
=SUMPRODUCT(($C$1:$C$22>DATE(2012,5,5))*($C$1:$C$22<DATE(2012,5,15))*($D$1:$D$22="error5"))


Love to have your comments....


Read more »

Thursday, April 17, 2014

The remote server returned an error 407 Proxy Authentication Required

One of our clients reported that they could not access a certain web page from another domain as they were getting the Proxy Authentication error even though they had entered the domain name, user name and password correctly for the proxy setting. The code handling proxy is shown below:

Code Snippet
  1. Imports System.Configuration
  2. Imports System.IO
  3. Imports System.Net
  4. Imports System.Text
  5.  
  6. Public Class Form1
  7.  
  8.     Dim InstallerSite As String
  9.     Dim UploadFile As String
  10.  
  11.     Dim MyProxy As New WebProxy
  12.     Dim ProxyPresent As Boolean
  13.  
  14.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  15.  
  16.         InitializeGlobals()
  17.         txtResult.Text = GetFile()
  18.  
  19.     End Sub
  20.  
  21.     Private Sub InitializeGlobals()
  22.  
  23.         InstallerSite = CType(ConfigurationManager.AppSettings("InstallerSite"), String)
  24.         UploadFile = CType(ConfigurationManager.AppSettings("UploadFile"), String)
  25.  
  26.         ' Case for when a Proxy is present.
  27.         ProxyPresent = CType(ConfigurationManager.AppSettings("ProxyPresent"), Boolean)
  28.         Dim ProxyUrl As String = CType(ConfigurationManager.AppSettings("ProxyUrl"), String)
  29.         Dim ProxyDomain As String = CType(ConfigurationManager.AppSettings("ProxyDomain"), String)
  30.         Dim ProxyUserName As String = CType(ConfigurationManager.AppSettings("ProxyUserName"), String)
  31.         Dim ProxyPassword As String = CType(ConfigurationManager.AppSettings("ProxyPassword"), String)
  32.         Dim credentials As New System.Net.NetworkCredential(ProxyUserName, ProxyPassword, ProxyDomain)
  33.         MyProxy.Address = New Uri(ProxyUrl)
  34.         MyProxy.Credentials = credentials
  35.  
  36.     End Sub
  37.  
  38.  
  39.     Private Function GetFile() As String
  40.  
  41.         Dim result As String = String.Empty
  42.  
  43.         Try
  44.  
  45.             Dim request As HttpWebRequest
  46.             Dim response As HttpWebResponse
  47.  
  48.             request = WebRequest.Create(InstallerSite & UploadFile)
  49.  
  50.             If ProxyPresent = True Then
  51.                 request.Proxy = MyProxy
  52.             End If
  53.  
  54.             response = request.GetResponse()
  55.             Dim responseStream As Stream = response.GetResponseStream()
  56.  
  57.             Dim buffer(10) As Byte
  58.             Dim bytesToRead As Integer = CInt(buffer.Length)
  59.             Dim bytesRead As Integer = 0
  60.             While bytesToRead > 0
  61.                 Dim i As Integer = responseStream.Read(buffer, bytesRead, bytesToRead)
  62.                 If i = 0 Then
  63.                     Exit While
  64.                 End If
  65.                 bytesRead += i
  66.                 bytesToRead -= i
  67.             End While
  68.  
  69.             result = Encoding.ASCII.GetChars(buffer)
  70.  
  71.         Catch ex As Exception
  72.  
  73.             result = ex.Message
  74.  
  75.         End Try
  76.  
  77.         Return result
  78.  
  79.     End Function
  80.     
  81. End Class


It turned out they needed to enter the IP address for their proxy domain not just the domain name.
Read more »

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

Read more »

Tuesday, April 15, 2014

Move Site between WordPress Blogger



Move your site between WordPress and Blogger


New bloggers are often confused about choosing the right platform for blogging. Most of them choose either WordPress or Blogger to start blogging. But after few months or years, depending on your requirements you may think to switch your platform. Both WordPress and Blogger let you move the site easily. And they support each other! 


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

  1. Sign in to your blogger account and go to the dashboard or control panel.
  2. Choose the settings option from the left pane and select other.
  3. Now hit on the Export Blog button from Blog Tools. 
  4. Download Blog > Save it as XML Document in your hard disk.
Now you can keep this XML file in your hard disk. Later you can use it anywhere. Learn more . . . 


Upload the file to WordPress

Now youve to upload the XML file to your WordPress site. First you have to access your WordPress Sites Admin Panel. Make sure youre signed in to your WordPress account. Now go to your site. And follow the steps below:

  1. This URL- http://.wordpress.com/wp-admin - will give you the direct access to your sites dashboard. Just replace the word with yours. 
  2. 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 . 
  3. Now hit on the Choose File button and select the XML file that youve stored earlier. 
  4. Now hit on the Upload File and Import. Import procedure will be started. This may take some time. 
Import and Export Tools in WordPress Admin Panel


WordPress to Blogger

Now Im gonna show the opposite work. Actually it doesnt happen normally. Only few bloggers leave WordPress. Sometimes new bloggers choose WordPress to start blogging. Later they find the platform difficult in compare to blogger. 

Its very simple. Just do the reverse work! 


Back up your WordPress Site

  1. Go to the WordPress Control Panel - http://yoursite.wordpress.com/wp-admin
  2. Then go to Tools > Export > Export Option > Export > Choose What to Export > All Content > Download Export File > Save as XML Document > Done! 

Back Up WordPress Site as XML


Store the file in your hard disk to upload anywhere in the futuer. 



Upload the File to Blogger


Now its time to upload your WordPress XML file to Blogger. Make sure youre signed in to your blogger account. And follow the steps below: 
  1. Go to Blogger Dashboard/ Control Panel.
  2. Go to Settings > Other > Blog Tools > Import Blog > Choose File > Select WordPress XML Document > Type Captcha properly > Import Blog > Done!

Restore XML Document into Blogger Blog


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!


Read more »

Constants fixed length strings arrays user defined types and Declare statements not allowed as Public members of object modules

Declaring the following in a Userform is one possible cause for the error:

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




Read more »

Monday, April 14, 2014

Add Control To PopupMenu

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
Read more »

Maximum Limit of Rows Columns etc in Excel

How BIG is Excel 2007 and 2010

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

Read more »

Sunday, April 13, 2014

How to increase your laptop batterys life

There is no matter, laptop manufactures gives you the guarantee about the battery that how long it works. The battery of laptop always stops working very early at some stage in essential research, just like when you are watching a DVD movie.



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.
Read more »

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
Read more »

Saturday, April 12, 2014

Excel Pivot Tables

Pivot tables are small databases that tend to add functionality to your data.Constructing a pivot table is easy and using it is more easy
Read more »

Friday, April 11, 2014

How to avoid BLANKS errors in CHARTS


Prerequisite 

Able to use/create charts in Excel. Know how to use "ISERROR" formula. Please refer to Microsoft help for Syntax.

Possible Usage

To reflect a clean and accurate in formation in charts.

For example, refer to the table below.

”how

If we plot Reject Percentage Vs Date we will get,

”how


First the chart is not accurate as there was no production in certain days and reject rate cannot be considered "Zero".
Second the chart is not tidy. 

The steps (How to do)

1. type =IF(ISERROR(C2/B2)=TRUE,#N/A,C2/B2) in D2

2. Drag or Copy/Paste all the necessary cells

”how


3. We will get a clean and accurate chart

”how


DONE




Read more »

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.


My personal choice for this purpose is Web Rank Toolbar. Today I am gonna show you how to install this toolbar on Firefox and Google Chrome.

Follow the steps below:

  1. First, make sure you are using Google Chrome or Firefox.
  2. If you are a chrome user then click here. And Firefox users can use this link.
  3. 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
  4. Then click on install. Firefox should be restarted. But chrome doesnt need to be restarted. 
  5. 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. 


Read more »

Thursday, April 10, 2014

Evaluating Formulas

In the past, whenever I have talked about debugging or evaluating a formula, I have always talked about the Evaluate Formula icon found on the Formula ribbon
It is very useful as it allows you to break apart complex formulas step by step. Click Evaluate to examine the value of the reference that is underlined. The result of that evaluation is shown in italics.

If the underlined part of the formula is a reference to another formula, click Step In to display the other formula in the Evaluation box. Click Step Out to go back to the previous cell and formula.  And then just keep going until you have worked your way through the entire formula.





If it is a long complex formula, I still think this is the best method but I learned a quicker method the other day on Chandoos site and I think it is really useful if you are in a hurry or the formula is relatively short.
( If it is a long complex formula, I think it is easier to see the breakdown in the Evaluate Formula dialog box. - just my personal preference.)













 All you need to do is double-click on the formula, select the component that you want to evaluate and press F9. If you have additional formulas, select them and press F9 again. When you are done, press ESC to get out.

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.
Read more »

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)

Read more »

Firefox 3 Its Almost Ready

For the past couple of weeks, news about Firefox 3 has been spreading like wildfire all over the Web. Users have been desperately trying to figure out when it will be released and more importantly, how much longer theyll have to wait. Several posts have been made on WorldStarts message board about it as well and since it seems like so many of you are invested in the new version of the popular Web browser, I thought Id give you a little update of my own. Check it out!

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!
Read more »