+ Reply to Thread
Results 1 to 6 of 6

Worksheet_Change(ByVal Target As Range) update horizontally.

  1. #1
    Registered User
    Join Date
    02-10-2010
    Location
    India
    MS-Off Ver
    Office XP
    Posts
    10

    Red face Worksheet_Change(ByVal Target As Range) update horizontally.

    hi!

    I'm using Windows XP and Office XP.

    My query is :
    I have the following code. which is updating data in "A1" to Column "B" for next 30 rows i.e."b1","b2","b3" and so on till ("b30")next 30 rows.

    For my new project in which I have 500 cells i.e. "A1" to "A500"(which is vertically updating into different sheets, excel add-in name is traderxl). And I want to update them horizontally. i.e. the data will update to "f1","g1","h1" and so on till("am1") next 30 columns(in a single sheet).
    I tried a lot with my knowledge but couldn't make it. So, your help as usual is needed.

    Thanks in advance!

    Please Login or Register  to view this content.
    Last edited by DonkeyOte; 02-10-2010 at 03:14 AM. Reason: added closing CODE tag

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Worksheet_Change(ByVal Target As Range) update horizontally.

    Welcome to the Board.

    First off - I see you tried to use CODE tags, you added the opening tag correctly but forgot to add the Closing CODE tag [*/CODE*] (without *) ... I've modified for you on this occasion.

    So if I understand you're saying you want updates to A1 to be placed in F1 onwards, correct ?

    If we assume B:E may / may not be blank then perhaps the below will work for you (untested)

    Please Login or Register  to view this content.

    I would make the point though that if A1:A500 are updating via a formula / DDE the Change event won't fire as and when the values are recalculated.
    Last edited by DonkeyOte; 02-10-2010 at 03:32 AM. Reason: coding on the fly again... missed variable declaration

  3. #3
    Registered User
    Join Date
    02-10-2010
    Location
    India
    MS-Off Ver
    Office XP
    Posts
    10

    Thumbs up Re: Worksheet_Change(ByVal Target As Range) update horizontally.

    Thank you very much, Sir.

    It's the exactly thing I was trying to do.

    Thanks once again!

  4. #4
    Registered User
    Join Date
    02-10-2010
    Location
    India
    MS-Off Ver
    Office XP
    Posts
    10

    Re: Worksheet_Change(ByVal Target As Range) update horizontally.

    Dear Sir,

    Thank you for your precious help.

    The code is working fantastically. There is only one problem. In column "E" I have set moving average 30 formula i.e. =sum(f1:am1)/30. So, when the updating data reaches to column "AN", column "F" should deleted. Then only I'll have correct average of last 30 minutes data.

    Can you please do it for me?

    Thanks and regards

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Worksheet_Change(ByVal Target As Range) update horizontally.

    You reference 30 values commencing from Col F - on which basis the below assumes last value should be placed in Col AI (or before where fewer than 30 records exist)
    (not sure where AN comes into it ?)

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-10-2010
    Location
    India
    MS-Off Ver
    Office XP
    Posts
    10

    Smile Re: Worksheet_Change(ByVal Target As Range) update horizontally.

    Sorry Sir,

    I did mistake. you are right. "AN" comes nowhere in this code.

    But, you did it perfactly.

    Thanks a ton.

    Thank you Sir, Thank you so much.

+ 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