I want to share my best work for the people who have a passion for Microsoft Excel.
I especially focussed on the VBA MACRO based Applications in MS EXCEL for,
Automation of Reports
Applications like sale purchase invoice printing. Etc...
Today, I want to share my first coding in VBA to all.
Sometimes you need to select dynamically the whole data from the column to copy them automatically in anywhere. Maybe sometimes it happens when your worksheet went full of data or filled partially but you need to select data of any column automatically till it's the last cell then?
I have done the coding for that task. Here it is. Just paste it into your VBA module.
Code:
Sub Test_Module_1()
'By Kamal Bharakhda
Sheets("Assignment No. 1").Activate
Columns("B").Select
A = Selection.Rows.Count
LastCellofSheet = ActiveSheet.Cells(A, 2).Value
MsgBox "WorkSheet's Last Cell Value is" & " = " & LastCellofSheet
If LastCellofSheet = 0 Then
MsgBox "Worksheet's Last Row!" & " is = " & A
ActiveSheet.Cells(A, 2).End(xlUp).Select
B = ActiveCell.Row
C = ActiveCell.Column
MsgBox "Last Row of Column's Data" & " is = " & B
Range("B1", Cells(B, C)).Select
End If
End Sub
By Kamal Bharakhda
Subscribe to:
Post Comments (Atom)
IsValidPasswordString Function
'Following function will verify if the password string contains following characters or not? Rem : List of Characters Group - ASCII Rem ...
-
Here is the complete VBA code to import XML Data into the Excel Workbook in a completely dynamic approach. Look at the following video. ...
-
Show and Hide Columns one by one by Spin button up to mentioned columns limits. this is going to be the best small tool for excel users. ...
-
When we talk about Developing Apps on Excel VBA, we have two straight options for designing the user interface of the app. 1. Worksheet base...
No comments:
Post a Comment