Skip to content

Instantly share code, notes, and snippets.

View thoriqmacto's full-sized avatar
🎯
Focusing

Thariq thoriqmacto

🎯
Focusing
View GitHub Profile
=OFFSET(Import_LOOP!$A$2,0,0,COUNTA(Import_LOOP!$A:$A)-1,1)
For Each MyCell In Range("A2:A6")
Function CheckSheet(pName As String) As Boolean
Dim IsExist As Boolean
IsExist = False
For Each ws In Worksheets
If ws.Name = pName Then
IsExist = True
Exit For
End If
Next
@thoriqmacto
thoriqmacto / [js] A Good Habit
Last active August 29, 2015 14:06
Javascript in closure for a good habit!
(function(){
var app = angular.module('foo',[]);
app.controller('FooController', function(){
// bla...bla...bla...
});
})();
@thoriqmacto
thoriqmacto / [VBA] Lastrow
Last active January 10, 2021 13:34
find lastrow using vba
'For columns which has non-blank cells
Range("A" & Rows.Count).End(xlUp).Row
'For columns which has active cells
Range("A1").SpecialCells(xlCellTypeLastCell).Row
@thoriqmacto
thoriqmacto / [vba] last filled column
Created October 13, 2014 08:32
find the last column used in a particular row
'If you want to find the last column used in a particular row you can use:
Dim lColumn As Long
lColumn = ws.Cells(1, Columns.Count).End(xlToLeft).Column
@thoriqmacto
thoriqmacto / [vba] routine for browse a file
Created October 28, 2014 09:33
This routine is to show open file dialog and get the path of the file.
Sub browseFile()
Dim desPathName As Variant
desPathName = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls*), *.xls*", Title:="Please select a file")
Range("D8").Value = desPathName
End Sub
@thoriqmacto
thoriqmacto / [vba] print checkbox and name it dynamically
Created October 28, 2014 09:36
This routine will print checkbox object to the worksheet and dynamically assigned name to each of it.
Sub printCbox()
Dim i As Integer
Dim jmlhCSN As Integer
Dim left, topp As Double
Dim width, height As Double
jmlhCSN = 16
For i = 1 To jmlhCSN
left = 10 'Cells(i,"A")
@thoriqmacto
thoriqmacto / [VBA] GetResponseHTML()
Last active January 20, 2021 07:49
Perform HTTP request to certain sites and parse the HTML doc return using VBA with specified class attribute. Must enabled the "Microsoft HTML Object Library" reference.
Public Function GetResponseHTML(ByVal strUrl As String, ByVal className As String, ByVal strDelimiter As Variant, Optional strRespText As String = "", Optional flagVerbose As Boolean = False) As Variant
Dim oHtml As HTMLDocument
Dim oElement As Object
Dim i As Integer
Dim out() As Variant
Set oHtml = New HTMLDocument
With CreateObject("WINHTTP.WinHTTPRequest.5.1")
.Open "GET", strUrl, False
.send
@thoriqmacto
thoriqmacto / PatternAdapter_Error.php
Created October 30, 2015 07:19
[PHP] Adapter Pattern Example
<?php
class errorObject{
private $__error;
public function __construct($error){
$this->__error = $error;
}
public function getError(){