Hey!
I am working man hours calculation in excel which comes around
8500 rows and 250 columns in a sheet.
When I try to run a macro or any function (as Save, Paste, Bold or Copy) it
is dead slow and takes an hour for whatever functions.
I have Dell optiplex 790, i3-2.42 with 4 GB RAM with good speed.
I have Macro settings to "Enable all macros (not recommended...... and Truste all VBA project model...
Please some genius help me what is the problem or any settings I need to change or any mistake I am doing...?
below is my macro:
Option Explicit
Sub CommandButton1_Click()
Dim i As Integer
Dim j As Integer
'Double Shift
Dim X1 As String
Dim X2 As String
Dim X3 As String
Dim X4 As String
For i = 10 To 8371
X1 = Me.Cells(i, 1)
X2 = Me.Cells(i, 2)
For j = 10 To 8371
X3 = Me.Cells(j, 1)
X4 = Me.Cells(j, 2)
If X1 = X3 And X2 = X4 And j <> i Then
Range("DJ" & j & ":" & "DM" & j).Interior.Color = RGB(0, 5900, 0)
End If
Next
Next
End Sub
Sub HideCol()
' hides the columns marked with an X
Showcol
Rows("2:2").SpecialCells(xlCellTypeFormulas, 22).EntireColumn.Hidden = True
End Sub
Sub Showcol()
Cells.EntireColumn.Hidden = False
End Sub
Sub Flip()
' thanks to Roger Govier for suggesting this macro
' that hides the unmarked columns (those with a zero instead of an X)
Showcol
Rows("2:2").SpecialCells(xlCellTypeFormulas, 21).EntireColumn.Hidden = True
HideCol
End Sub
Sub Button2_Click()
Dim X1 As Integer
Dim X2 As Integer
Dim X3 As Integer
Dim X4 As Integer
Dim na1 As String
Dim na2 As String
Dim date1 As String
Dim date2 As String
Dim thod As String
'list of employees made for OT list after all calculation in right side
For X1 = 8 To 342
'column number which creteria name + number lies
na2 = Me.Cells(X1, 135)
'within this column full month from 01.01.10 to 31.01.10)
For X2 = 170 To 200
'row number where all heading lies
date2 = Me.Cells(7, X2)
'this is entire calculation total number of which lies in column "A"
For X4 = 8 To 8371
date1 = Me.Cells(X4, 1)
na1 = Me.Cells(X4, 2)
'MsgBox (" -0- " & na1 & " -1- " & na2 & " -2- " & date1 & " -3- " & date2)
If na2 = na1 And date2 = date1 And Me.Cells(X1, X2) = "" Then
Me.Cells(X1, X2) = Me.Cells(X4, 235)
ElseIf na2 = na1 And date2 = date1 And Me.Cells(X1, X2) <> "" Then
Me.Cells(X1, X2) = Me.Cells(X1, X2) & "/" & Me.Cells(X4, 235)
End If
Next
Next
NextEnd Sub
Regards,
Charles P
Bookmarks