• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Macro question

bignoggin

New Member
I have a worksheet that is 15000 cells long and I was wondering if there is a way I can make a macro the copy all the cells between 2 keywords. from a cell that has "Conference" in it until the next cell that has "Conference" in it

All the cells are in column A
 
Im still not sure if I can use these to Move a section of cells to a different worksheet so the rest of my macro can run the data from there.

Any help with this would be greatly appreciated
 
What I'm working with is data that is being presented like this(this is all in column A):

Conference Description: Number 1
Number 1 Data
Number 1 Data

Conference Description: Number 2
Number 2 Data
Number 2 Data

I am trying to get the macro to move the data starting at that first "Conference Description" until it gets to the next "Conference Description" and move it to a separate sheet like:

Conference Description: Number 1
Number 1 Data
Number 1 Data

I cant just have it move a fixed number of rows because the "Number 1 data" is variable sometimes its 2 rows sometimes its 200
 
Hi,

See if this is Ok.

Code:
Sub SearchText_Move2_OtherSheets()
'This macro will find the Description till it occurs in column A

Application.ScreenUpdating = False

    Dim SearchCell As Range
    Dim SearchRange As Range
    Dim SearchDescription As String
    Dim FirstSearchCell As String
           
    Worksheets("Sheet1").Activate
       
    SearchDescription = InputBox("Enter text you want to search!")
   
    Set SearchRange = Range("A2", Range("A1").End(xlDown))
   
    Set SearchCell = SearchRange.Find(what:=SearchDescription, MatchCase:=False, lookat:=xlPart)
   
    If SearchCell Is Nothing Then
        MsgBox "Text was not found"
    Else
       
        FirstSearchCell = SearchCell.Address
        Do
            Range(SearchCell, SearchCell.End(xlToRight)).Copy
            Worksheets("Description").Activate
            ActiveCell.PasteSpecial
            ActiveCell.Offset(1, 0).Select
   
            Worksheets("Sheet1").Activate
           
            Set SearchCell = SearchRange.FindNext(SearchCell)
        Loop While SearchCell.Address <> FirstSearchCell
    End If
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
 
Back
Top