Results 1 to 3 of 3

Thread: Block End IF

  1. #1
    Join Date
    Mar 2009
    Posts
    1

    Question Unanswered: Block End IF

    Hi All,

    My first post here...

    I have this code :

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Row = 5 Then
    '-- suppression
    For Each s In ActiveSheet.Shapes
    If s.Type = 13 Then
    If s.TopLeftCell.Address = Target.Offset(0, 1).Address Then
    s.Delete
    End If
    End If
    Next s
    '--
    Sheets("status").Shapes(Application.Substitute(Tar get, " ", "")).Copy
    Target.Offset(1, 0).Select
    ActiveSheet.Paste
    Selection.ShapeRange.Left = ActiveCell.Left + 7
    Selection.ShapeRange.Top = ActiveCell.Top + 5
    Target.Select
    End If
    End Sub

    The "Row 5" part is where i am having the problem. I also need this code to include Row 9 and 13.

    Please could someone give me a helping hand to do this. I attempted myself but kept getting a message about End If's which i didnt understand.

    Thanks in advance for your help.

    Emma x

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Code:
    If Target.Row = 5 Or Target.Row = 9 Or Target.Row = 13 Then
    George
    Home | Blog

  3. #3
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    block end if

    The err.msg you get is that you have an : if ; end if ; Loop ; next ; for each
    to much or less.

    But can't see them in your code that you've posted.

    ie this will give block end if err.:

    Dim ilCount as integer =0

    if ilCount > 0 then
    msgbox ("Your count is zero")
    exit try
    else
    ilCount+=1
    endif

    if ilCount >0 then
    msgbox ("Your count is " & ilCount)
    ' <--- missing end if here (will be same with an loop or for each)
    Greetz Marvels -^.^-
    Developments : VB4 Through .Net; Basic; DOS ; CNC ; Sinclair
    Databases : SQL Server Through 2005; Access 3 Through 2003 ; Oracle 8 & 9.i ;
    OS : Win 3.11 Through XP ; NortonComander ; DOS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •