Hi All
I was helped in my forst post on this forum with the code below but now as part of my development I want to all the routines in my project to reference their ranges fro "A1" as at a later stage I want to move the active cell and repeat the same steps.
I have hit a snag as the code below works when using a original Range as ("D5:D205") but completely fails when I ret and use OFFSET to define the range. I have stepped trough the code and it jumps out at If Not c is Nothing - which I guess means it has not seen a starting value in the range.
Any pointers greatly appreciated. I'm on a steep learning curve here lolThanks
Mark
I was helped in my forst post on this forum with the code below but now as part of my development I want to all the routines in my project to reference their ranges fro "A1" as at a later stage I want to move the active cell and repeat the same steps.
I have hit a snag as the code below works when using a original Range as ("D5:D205") but completely fails when I ret and use OFFSET to define the range. I have stepped trough the code and it jumps out at If Not c is Nothing - which I guess means it has not seen a starting value in the range.
Code:
Sub Transpose_Data()
Dim c As Range
Dim firstaddress As String
Application.ScreenUpdating = False
'original range reference ("B5:B206") This works when added after Range in the line below
'but the current line does not
With Sheets("Data Gathering").Range("B5:B206") ' (ActiveCell.Offset(5, 1), ActiveCell.Offset(5, 205))
Set c = .Find(What:=0, LookIn:=xlValues, LookAt:=xlWhole)
If Not c Is Nothing Then
firstaddress = c.Address
Do
TposeS1 Target:=c
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstaddress
End If
End With
Range("A1").Activate
End Sub
Sub TposeS1(ByVal Target As Range)
Target.Offset(0, -1).Resize(Target.Rows.Count + 1).Copy
Target.Offset(0, 2).PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Application.CutCopyMode = False
End Sub
Sub Fill_Time_Calc()
'Adds formula to calculate the time difference between Excpetion end and Exception Start
'If no times exist in the left side 2 cells error is replaved with ""
With Range(ActiveCell.Offset(5, 5), ActiveCell.Offset(205, 5))
.NumberFormat = "dd hh:mm"
.Value = "=IF(SUM(RC[-2]-RC[-1])=0,"""",SUM(RC[-2]-RC[-1]))"
End With
End Sub
Any pointers greatly appreciated. I'm on a steep learning curve here lolThanks
Mark