+ Reply to Thread
Results 1 to 2 of 2

Select Case Statement Help

Hybrid View

  1. #1
    Registered User
    Join Date
    09-22-2006
    Posts
    4

    Question Select Case Statement Help

    Hi all

    I am trying to teach myself some VBA code, but anm going around in circles.

    I wish allow the user to update certain cells A1, A4, A7, A10 and A13

    However I imeediately want what they have entered to change to the corresponding row in column "J"

    i.e. I enter something into cell A1, and as soon as I press enter what I have typed is replaced with the contents of cell J1.... A4 is replaced with J4 and so on.

    It is important that only these cells are updated inthis way.

    Any help would be much appreciatted

  2. #2
    Forum Contributor starryknight64's Avatar
    Join Date
    09-27-2006
    Location
    Missouri
    MS-Off Ver
    2003 (Work) & 2007 (Home)
    Posts
    193
    Maybe I'm a newb, but after lots of head scratching I came up with this...

    Private Sub Worksheet_Change(ByVal Target As Range)
        If Intersect(Target, Range("A1")) Is Nothing And Intersect(Target, Range("A4")) Is Nothing And Intersect(Target, Range("A7")) Is Nothing And Intersect(Target, Range("A10")) Is Nothing And Intersect(Target, Range("A13")) Is Nothing Then
            Exit Sub
        Else
            Dim i As Integer
            i = 1
            
            While i <= 13
                If Cells(i, 1) <> Cells(i, 10) Then Cells(i, 1) = Cells(i, 10)
                i = i + 3
            Wend
        
        End If
    End Sub
    Just copy and paste this under "Microsoft Excel Projects" -> "Sheet1 (Sheet1)" and it should work exactly how you described it.
    starryknight64

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1