EXCEL_DOC001 VERSION: 2.1 - 06MAR2016

 

--- COLUMNS & ROWS ---

LAYOUT

Columns(iA).ColumnWidth = 0.33          'Default 0.83

Rows(iA).RowHeight = 12  

 

RGB Color

Cells(iX, iY).Interior.Color = RGB(iRed, iGreen, iBlue)  

ColorIndex  

Cells(iDealNo + 1, "H").Interior.ColorIndex = 22  

 

POSITION

Dim iMaxrow As Long

iMaxrow = Worksheets("HDA Overview").range("B4").Value

Cells(iDealNo, "A").Value = "DEAL_SEQ_NUMBER"

iBuyPrice = Worksheets("HDA DataAdd").Cells(iBuyDay, "B").Value

 

--- WORKSHEET ---

Application.Workbooks(iStidTagBook).Worksheets("TAG_SUMMARY").Activate                

 

--- FILE COMMANDS ---

 

CLOSE

Workbooks("close-open-workbooks.xls").Close

Workbooks(1).Close

ActiveWorkbook.Close

 

4. The code line below closes all workbooks that are currently open.

Workbooks.Close

 

OPEN

Workbooks.Open ("sales.xls")

 

6. You can also use the GetOpenFilename method of the Application object to display the standard open Dialog box and select the file (without actually opening the file).

Dim MyFile As String

MyFile = Application.GetOpenFilename()

 

Workbooks.Open (MyFile)

 

MORE INFO: http://www.excel-easy.com/vba/examples/close-open.html

 

--- END ---

 

 

--- INTERFACE AND DEBUG ---

 

MsgBox "Error - more than 1 column." & vbNewLine & "You must select only one range in one column."

MsgBox iLoopStart & " " & iLoopEnd

 

--- END ---

 

Sub SG_x_Test_RowColDim()

'TEST

 

 

    Dim iA, iB, iCount As Integer, iCC As String

    Dim iRed, iGreen, iBlue, iRow As Integer

    

  

    iCount = 300                                'Default 30

    iCC = "GREEN"

    

    For iA = 1 To iCount

    

        Columns(iA).ColumnWidth = 0.33          'Default 0.83

        Rows(iA).RowHeight = 12                 'Default 7.5 - use 12 to fit text size 8

        

    Next

 

 

    Columns(1).ColumnWidth = 20

    

    For iRow = 1 To 400

    

        iX = Int((60) * Rnd + 1)

        iY = Int((iCount - 1) * Rnd + 1) + 1

        

        If iCC = "RED" Then

            iRed = Int((200) * Rnd + 55)

            iGreen = Int((20) * Rnd + 20)

            iBlue = Int((55) * Rnd + 20)

        ElseIf iCC = "GREEN" Then

            iRed = Int((20) * Rnd + 20)

            iGreen = Int((200) * Rnd + 50)

            iBlue = Int((40) * Rnd + 20)

        ElseIf iCC = "BLUE" Then

            iRed = Int((200) * Rnd + 55)

            iGreen = Int((20) * Rnd + 20)

            iBlue = Int((55) * Rnd + 20)

        Else

            MsgBox ("ERROR - SELECT COLOR TYPE")

            Exit Sub

        End If

        

        Cells(iX, iY).Interior.Color = RGB(iRed, iGreen, iBlue)

        

    Next iRow

 

 

            

End Sub