This is VBA not VB.NET
Try .Value of Cell
Function VendorName5() As String
Name = ActiveCell.Offset(0, -4).Value
VendorName5 = Name
End Function
Answer from Fabio on Stack OverflowThis is VBA not VB.NET
Try .Value of Cell
Function VendorName5() As String
Name = ActiveCell.Offset(0, -4).Value
VendorName5 = Name
End Function
Why not use the Offset function:
In cell A1:
=OFFSET(A1,0,4,1,1)
Or, refer to the cell directly:
=E1
etc.
This seems overkill to use a UDF to do something that worksheet functions ordinarily allow for, already.
vba - ActiveCell.Offset Confusion - Stack Overflow
VBA, select range using two offset cell references
Selecting a block of cells using offset
Use Range.Offset Method with cell value
Videos
Sub Find_True_SD()
'Selects 'Southern Domestic' Worksheet, selects range (M1:M550). Finds 'True' value in column 'M', then selects the range specified so that it can copy and paste in another worksheet.
Sheets("Southern Domestic").Select
ActiveSheet.Range("M1:M550").Select
Selection.Find(what:="True", LookIn:=xlValues).Select
Selection.Offset(0, -12).Select
Selection.Offset(14, 10).Select
End SubI would like to copy and paste a range of information into another worksheet.
I have numerous tables for each half hour of a work shift. Each table has a True/False value in Column M depending on the current time. E.g. at 12:37pm, the table covering 12:30pm until 1:00pm would have a value in the M column stating True, the 1:00pm until 1:30pm table would have a false value in the M column and so on for each half hour period.
I am currently able to find and select the True value within the M column, I can then select either the start or end of the range I want to copy using the selection.offset(). select method but I cannot manage to select all of it.
I have tried things such as:
Range(selection, selection.offset(14,10)).select
but I get a runtime error 1004, application defined or object defined error.
Any help would be appreciated.



