Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jun 2002
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Inverting a Spreadsheet (2002)

    My partner has several large crochet patterns set up as Excel spreadsheets. The cells are either blank or contain an "x" creating the crochet pattern. She would like to invert the spreadsheet or create a mirror image of it. I know you can invert or rotate objects but this does not apply to the sheet itself.

    I thought I remember reading somewhere there was an easy way to invert a spreadsheet but cannot remember where or how to do this. Any suggestions please?

    Thanks,
    Rob

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Inverting a Spreadsheet (2002)

    Is this what you are after?
    Select the range of cells run the macro and it will ask if you want Hori or vertically and then where to put it (you can put it in the orginal spot if desired.)

    Steve

    <pre>Option Explicit
    Sub InvertRange()
    Dim iResponse As Integer
    Dim lRows As Long
    Dim lRow As Long
    Dim iCols As Integer
    Dim iCol As Integer
    Dim vSource
    Dim vDest()
    Dim rngDest As Range
    vSource = Selection.Value
    iResponse = MsgBox("Do you want to Invert:" & vbCrLf & _
    "Horizontally (Yes) Or" & vbCrLf & _
    "Verically (No)", vbYesNo, "Horizontal or Vertical")

    Set rngDest = Application.InputBox( _
    "Where do you want to Put the inverted copy?", Type:=8)

    lRows = UBound(vSource, 1)
    iCols = UBound(vSource, 2)
    ReDim vDest(1 To lRows, 1 To iCols)

    For lRow = 1 To lRows
    For iCol = 1 To iCols
    If Not IsEmpty(vSource(lRow, iCol)) Then
    If iResponse = vbYes Then
    vDest(lRows - lRow + 1, iCol) = _
    vSource(lRow, iCol)
    Else
    vDest(lRow, iCols - iCol + 1) = _
    vSource(lRow, iCol)
    End If
    End If
    Next
    Next
    rngDest.Cells(1).Resize(lRows, iCols) = vDest
    End Sub</pre>


  3. #3
    New Lounger
    Join Date
    Jun 2002
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inverting a Spreadsheet (2002)

    Steve, thanks very much, that works perfectly and a neat little macro too.

    Thanks again,
    Rob

Posting Permissions

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