Please Please someone help me i'm gon to be mad

magicgood

New Member
Joined
Dec 22, 2019
Messages
9
Office Version
  1. 2013
Platform
  1. Windows
I trying to make a project to my work but I stuck now with Vb for like a week every time I fix a problem I faced a new one until now I face a problem I can't solve it I will attach the file and the problem when I try to add a new row or delete a row it's case error
link to my file :

my code in worksheet section
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("E:E")) Is Nothing Then

ElseIf Range("E" & Target.Row) <> "" Then
Range("G" & Target.Row) = "In Progress"
Else
Range("g" & Target.Row) = ""
End If

If Not Application.Intersect(Range("H:H"), Range(Target.Address)) _
Is Nothing Then
Dim myToAdd As String

If Target.Column = 8 Then
If Target.Value = "" Then Exit Sub
If Target.Value = "Test1" Then
myToAdd = "Test1@test1.com"
ElseIf Target.Value = "test2" Then
myToAdd = "Test2@test2.com"

'Else
'etc.....
End If
If MsgBox("Do you want to send EMAIL to " & Target & " ?", vbYesNo + vbQuestion, "Confirm Sending Email") = vbNo Then Exit Sub
End If


With CreateObject("Outlook.Application").CreateItem(0) '0 will create a new email item
.To = myToAdd
.CC = ""
.Subject = "You Have a new ( Activities / Tasks / Items )" & " " & Target.Offset(0, -3).Value & " " & "assigned to you"
.Body = "Dear," & " " & Target & vbNewLine & vbNewLine & "You Have a new ( Activities / Tasks / Items )" & " " & Target.Offset(0, -3).Value & " " & "assigned to you Please follow up till have it Closed or assigned to the responsible ." & vbNewLine & vbNewLine & vbNewLine & vbNewLine & "Keep it up" & vbNewLine & "STANDARDIZATION & COMPLIANCE"
.display 'Change this to .Send
End With

End If

End Sub


code in work book section
Private Sub Workbook_Open()
ActiveWindow.Zoom = 100
End Sub

code in module
Option Explicit

Private Sub CommandButton1_Click()
addNewRow
End Sub

Sub addNewRow()

' Do not insert a row before the first row.
Dim iTopRow As Integer
iTopRow = 5

If (ActiveCell.Row > iTopRow) Then

' Get the active row number.
Dim rowNum As Integer
rowNum = ActiveCell.Row

Rows(rowNum).EntireRow.Insert ' Insert a new row.

' Change the Codes (in first column).
Cells(ActiveCell.Row, 1) = rowNum - 4 ' For the active cells.

Dim iTotalRows As Integer ' Get the total used range rows.
iTotalRows = ActiveSheet.UsedRange.Rows.Count

Dim iRows As Integer

For iRows = rowNum + 1 To iTotalRows
Cells(iRows, 1) = iRows - 4
Cells(Application.ActiveCell.Row, 7).Select
Next iRows
End If
End Sub



any help will be more than appropriation
 
Last edited by a moderator:
So you think that means you can ignore the rules you agreed to abide by when you joined??? Did you even bother to read the rules on any of the affected forums?
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Evidently you're not interested in complying with the rules you agreed to abide by when you joined any of these forums... Did you even bother to read them?
 
Upvote 0
So you think that means you can ignore the rules you agreed to abide by when you joined??? Did you even bother to read the rules on any of the affected forums?
No i don't ignore it
Rule #13:
We prefer that members do not cross-post questions to other forums, but when this does occur members should do the following:

  • Post the details of your question on our forum. Do NOT simply post a link/re-direct to the question in another forum with no details posted here.
  • Make it clear that you have cross-posted and provide links to the cross-posts.
But it say prefer . And if done not mean i ignore it
 
Upvote 0
No i don't ignore it
Rule #13:
We prefer that members do not cross-post questions to other forums, but when this does occur members should do the following:

  • Post the details of your question on our forum. Do NOT simply post a link/re-direct to the question in another forum with no details posted here.
  • Make it clear that you have cross-posted and provide links to the cross-posts.
But it say prefer . And if done not mean i ignore it
The part you quoeted also says:
should do the following
which you did not do. The rule goes on to say:
Cross-posted questions that do not comply may be deleted or locked.
With your attitude, don't expect any help on any forum.
 
Upvote 0
The part you quoeted also says:

which you did not do. The rule goes on to say:

With your attitude, don't expect any help on any forum.

my attitude ?? you don't know me so Do not bother yourself with what i expect and i cant find the way to edit my post to Make it clear that i have cross-posted
 
Upvote 0
Does this work for you.....

VBA Code:
Sub addNewRow()
  
    ' Do not insert a row before the first row.
    Dim iTopRow As Integer
    iTopRow = 5
  
    If (ActiveCell.Row > iTopRow) Then

        ' Get the active row number.
        Dim rowNum As Integer
        rowNum = ActiveCell.Row
Application.EnableEvents = False
        Rows(rowNum).EntireRow.Insert       ' Insert a new row.
      
        ' Change the Codes (in first column).
        Cells(ActiveCell.Row, 1) = rowNum - 4       ' For the active cells.
      
        Dim iTotalRows As Integer   ' Get the total used range rows.
        iTotalRows = ActiveSheet.UsedRange.Rows.Count
      
        Dim iRows As Integer
      
        For iRows = rowNum + 1 To iTotalRows
            Cells(iRows, 1) = iRows - 4
            Cells(Application.ActiveCell.Row, 7).Select
        Next iRows
    End If
Application.EnableEvents = True

End Sub
thank you very much i appreciate your help its work fine now when i add new row but it still get error when remove a row . can a little more help with that
 
Upvote 0
@magicgood
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.

Please supply links to ALL other sites where you have asked this question.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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