Thread: [Solved] show a cell
View Single Post
 
Old 05-26-2012, 08:00 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,370
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi S7y,

Thanks for the explanation, but it's not really what I need. I need a workbook that is truly representative. It doesn't matter whether the data are real or fake - so long as they depict the structure of the real workbook and the kind of data it contains.

If I understand your latest post correctly, the workbook structure does represent the real one's layout, just not the kind of data or the shading. In that case, try:
Code:
Sub GetColRef()
Application.ScreenUpdating = False
Dim i As Long, j As Long, Rng As Range
With ThisWorkbook.Worksheets("Data")
  j = .Range("A" & .Rows.Count).End(xlUp).Row
  For i = 2 To j
    .Cells(i, 5).Value = ""
    Set Rng = ThisWorkbook.Worksheets("Report").Cells.Find(what:=Right(.Cells(i, 2).Value, 8), LookIn:=xlValues, _
      LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True)
    If IsNumeric(Rng.Offset(-1, 0).Value) Then
      If Rng.Offset(-1, 0).Value > 0 And Rng.Offset(-1, 0).Value < 100 Then
        .Cells(i, 5).Value = Rng.Offset(-1, 0).Value
      End If
    End If
    If IsNumeric(Rng.Offset(4, 0).Value) Then
      If Rng.Offset(4, 0).Value > 0 And Rng.Offset(4, 0).Value < 100 Then
        .Cells(i, 5).Value = Rng.Offset(4, 0).Value
      End If
    End If
  Next
End With
Set Rng = Nothing
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote