Results 1 to 6 of 6

Thread: Antoher piece of code to modify please Help!!![Resolved]

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    11

    Resolved Antoher piece of code to modify please Help!!![Resolved]

    Hello I have a code here that will find any bold cells in one sheet and caopy that cell and its row to another sheet (thanks Opus and RobDog888), Well my Co-worker had his friend come up with this code that works as well
    VB Code:
    1. Sub TransferDataPlease()
    2. Dim i As Long, n As Long
    3. Dim Sh1 As Worksheet, Sh2 As Worksheet
    4.  
    5. Set Sh1 = ActiveSheet
    6. Set Sh2 = Worksheets("Results") ' insert name here
    7. n = 1
    8. For x = Sh1.Range("A65536").End(xlUp).Row To 3 Step -1
    9.     y = 0
    10.     IsBold = False
    11.     Do
    12.         y = y + 1
    13.         If Sh1.Cells(x, y).Font.Bold = True Then IsBold = True
    14.     Loop While y <= 13 And IsBold = False ' Checks first 13 cols
    15.     If IsBold Then
    16.         n = n + 1
    17.         Sh1.Range("A" & x).EntireRow.Copy Sh2.Range("A" & n)
    18.     End If
    19. Next x
    20. End Sub
    ..Works Fantastic but there is a problem....It pasted the Data from the Bottom to the top on Worksheet2 (example if it were 3 rows to be pasted...instead of pasting row 1of workshheta to row 1 of worksheet b..it would paste row 1 of A into row 3 of B...kinda upsidedown....)

    .... i think the problem is here.
    VB Code:
    1. For x = Sh1.Range("A65536").End(xlUp).Row To 3 Step -1

    Because its searching for results from the bottom to the top.But when i try to modify it by flipping the arguments, it tells me that there is an " expected end of statment error"
    Can someone help me out here?

    thanks for taking a look.
    Last edited by The_Rookie; Jan 10th, 2005 at 06:46 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width