+ Reply to Thread
Results 1 to 3 of 3

Repeat Cut & Paste function with Range.offset function VBA

  1. #1
    Registered User
    Join Date
    10-05-2012
    Location
    Huntington Beach, CA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Repeat Cut & Paste function with Range.offset function VBA

    Hello,
    I am trying to automate a cut and paste function in this excel spreadsheet.
    This is what I need to do : I

    I need to cut the URLs in Column B and paste them into Column H.
    For instance, URL in Range B3 will get cut and pasted into Range H2.
    Url in Range B6 will get cut and pasted into Range H5.
    As you can see, there is a pattern. The URLs need to be pasted with a range.offset function of (-1,6).
    This needs to be repeated the until CELL B64.
    I know how to write code to cut and paste but I don’t know how to loop through the range of cells in order to REPEAT the cut and paste function through the range B3 to B64 .
    Any help would be greatly appreciated.

    This is the code I tried but it doesn't work. I have included the actual excel file I am practicing on. I have been out of touch with Excel for some time and I feel completely lost. Any help I appreciate greatly.

    Range("B3").Select

    Do While ActiveCell.Value <> Empty
    If InStr(ActiveCell.Value, "www.") = 0 Then
    ActiveCell.Cut
    ActiveCell.Offset(-1, 6).Select
    ActiveSheet.Paste
    End If
    Attached Files Attached Files

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,428

    Re: Repeat Cut & Paste function with Range.offset function VBA

    I assume the INSTR test should have be >0 rather than =0

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    10-05-2012
    Location
    Huntington Beach, CA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Repeat Cut & Paste function with Range.offset function VBA

    Andy,
    Thanks so much for your help. Your code works wonderfully.
    You've also given me inspiration and motivation to work harder at excel.

    Thanks so much and have a great weekend.
    Thanks again and greetings from California!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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