+ Reply to Thread
Results 1 to 2 of 2

Suggestions to improve my coding ability

  1. #1
    Registered User
    Join Date
    08-19-2015
    Location
    Traverse City
    MS-Off Ver
    2011
    Posts
    3

    Post Suggestions to improve my coding ability

    looking to get suggestions to improve the coding I have for a module.

    I finally got the code to run the way I need it to today.
    The issue is it is brute force and can only be ran once.



    Sub CopyOffset()
    Dim r As Range
    Dim c As Range
    Dim max_col As Long

    max_col = ActiveSheet.UsedRange.Columns.Count

    Range("M4").End(xlUp).Select

    Do Until IsEmpty(ActiveCell)

    If Left(ActiveCell.Value, 2) = "RS" Then
    Set r = Rows(ActiveCell.Row)

    For Each c In r.Cells
    'copy the value of each cell in the row to new location
    If c.Column = 0 Then
    'skip if value = 0
    ElseIf c.Column <= max_col Then
    ' Action
    ActiveCell.Select
    ActiveCell.Copy
    Cells.Find(What:="Rotor/Shaft Assy", After:=ActiveCell, LookIn:=xlValues _
    , LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    MatchCase:=False, SearchFormat:=False).Activate
    ActiveCell.Offset(0, 2).Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Cells.Find(What:="RS-", After:=ActiveCell, LookIn:=xlValues _
    , LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    MatchCase:=False, SearchFormat:=False).Activate

    Else
    Exit For
    End If

    Next c
    End If


    Loop


    End Sub

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Suggestions to improve my coding ability

    What's the code meant to do?

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    PS Can you add code tags when posting code?
    If posting code please use code tags, see here.

+ 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. Seeking some suggestions to improve my timesheet
    By jaywizz in forum Excel General
    Replies: 1
    Last Post: 08-03-2014, 08:45 PM
  2. Improve coding for a variable financial year
    By Zyphorion in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-19-2014, 07:10 AM
  3. [SOLVED] Vb macro coding for transpose - complete coding?
    By Dharani Suresh in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 08-02-2013, 11:16 PM
  4. [SOLVED] Vb macro coding for transpose - complete coding?
    By Dharani Suresh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-02-2013, 05:04 AM
  5. [SOLVED] CheckBox coding to work with ComboBox coding
    By JimExcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-05-2013, 12:23 PM
  6. how to improve bad macro coding
    By poitachi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-14-2010, 07:13 AM
  7. Suggestions to improve UDF
    By MrShorty in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-06-2006, 12:22 PM

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