Need solution with array or something like.

Status
Not open for further replies.

Slade

New Member
Joined
Aug 5, 2011
Messages
26
Hi

I have the following code in a macro. What it do is simple. In one column(H) i enter a time manually and in column(I) i have the current time. If H is bigger then I then do nothing if H is smaller than I bring up message box. This all work well but now i need to do it with more than 1000 line and to copy and paste is going to take allot of time that i do have but it will slow the workbook allot. is there a way i can use an array with the line number in the sheet1.range("H*") and sheet1.range("I*") and sheet1.range("J*"), * being the line number.

Code:
Sub Macro1()
    Dim MustTime As Integer
    Dim CurTime As Integer
    Dim CurTimeSt As String
    MustTime = Sheet1.Range("H7")
    MsgBox MustTime
    CurTimeSt = Sheet1.Range("I7").Text
    Sheet1.Range("J7") = Mid(CurTimeSt, 1, 2) & Mid(CurTimeSt, 4, 2)
    CurTime = Sheet1.Range("J7")
    If CurTime > MustTime Then
    MsgBox "Respond to:" + Sheet1.Range("C7")
    End If
End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Status
Not open for further replies.

Forum statistics

Threads
1,224,590
Messages
6,179,762
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top