+ Reply to Thread
Results 1 to 3 of 3

VBA newbie, Finding a value in cell range, activate cell run code find next value run code

  1. #1
    Registered User
    Join Date
    11-21-2014
    Location
    San Diego, CA
    MS-Off Ver
    office 2013
    Posts
    3

    VBA newbie, Finding a value in cell range, activate cell run code find next value run code

    I am trying copy data from sheet1 to sheet2 with my limited knowledge of VBA. Here is my code. Please assist.


    Sub excelmac()




    Sheets("Sheet1").Select
    Range("A7").Select

    Sheets("Sheet2").Select
    Range("A10").Select

    iMaxRow = 10



    For iCol = 1 To 1
    For iRow = 1 To iMaxRow

    With Sheets("Sheet1").Cells(iRow, iCol)

    If .Value = "REC#***" Then
    Else
    Sheets("Sheet1").Select
    'xqueue = Right(ActiveCell.Offset(-2, 0).Value, Len(ActiveCell.Offset(-2, -0).Value) - 0)
    xrec = Right(ActiveCell.Offset(-1, 0).Value, Len(ActiveCell.Offset(-1, 0).Value) - 0)
    xchgnum = Right(ActiveCell.Offset(0, 1).Value, Len(ActiveCell.Offset(0, 1).Value) - 0)
    xstartime = Right(ActiveCell.Offset(1, 1).Value, Len(ActiveCell.Offset(1, 1).Value) - 0)
    xendtime = Right(ActiveCell.Offset(2, 1).Value, Len(ActiveCell.Offset(2, 1).Value) - 0)
    ximpact = Right(ActiveCell.Offset(5, 6).Value, Len(ActiveCell.Offset(5, 6).Value) - 0)
    xdescrpt = Right(ActiveCell.Offset(8, 1).Value, Len(ActiveCell.Offset(8, 1).Value) - 0)

    Sheets("sheet2").Select

    'ActiveCell.Offset(-1, 0) = xqueue
    ActiveCell.Offset(0, 0) = xrec
    ActiveCell.Offset(0, 1) = xchgnum
    ActiveCell.Offset(0, 2).Value = xstartime
    ActiveCell.Offset(0, 3).Value = xendtime
    ActiveCell.Offset(0, 4).Value = ximpact
    ActiveCell.Offset(0, 5).Value = xdescrpt
    ActiveCell.Offset(1, 0).Select
    'Sheets("Sheet1").Select
    If .Value = "REC#***" Then
    Else

    End If
    End If
    End With
    Next
    Next
    End Sub

  2. #2
    Registered User
    Join Date
    11-21-2014
    Location
    San Diego, CA
    MS-Off Ver
    office 2013
    Posts
    3

    Re: VBA newbie, Finding a value in cell range, activate cell run code find next value run

    my output looks like this

    REC# 1 1212121234 11/10/2014 12:00 11/10/2014 12:45 Minor Impact Do something now
    REC# 1 1212121234 11/10/2014 12:00 11/10/2014 12:45 Minor Impact Do something now
    REC# 1 1212121234 11/10/2014 12:00 11/10/2014 12:45 Minor Impact Do something now
    REC# 1 1212121234 11/10/2014 12:00 11/10/2014 12:45 Minor Impact Do something now
    REC# 1 1212121234 11/10/2014 12:00 11/10/2014 12:45 Minor Impact Do something now

    I would like it to scroll to the next record in sheet 1 and grab the results and repeat until no more records are found in the column

    Thanks

  3. #3
    Registered User
    Join Date
    11-21-2014
    Location
    San Diego, CA
    MS-Off Ver
    office 2013
    Posts
    3

    Re: VBA newbie, Finding a value in cell range, activate cell run code find next value run

    I figured it out. I was way off.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Code look through range of cells, find blanks & delete cell range in the same row,
    By EagleInsight in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-10-2014, 11:24 AM
  2. VBA Code to activate cell if text is found in cell, if not find next value
    By snelson0713 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-01-2013, 11:31 AM
  3. VBA Code: Activate Workbook Using Cell Value
    By vidyuthrajesh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-17-2012, 12:55 PM
  4. Activate code with value in cell
    By jamphan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2007, 03:03 PM
  5. Activate code in cell
    By Steve in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-18-2005, 03:05 PM

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