View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
roblo[_7_] roblo[_7_] is offline
external usenet poster
 
Posts: 1
Default Help in using an Offset in a .Range().Select


Thanks Jake for the suggestion, but it does not work in my .VBS script.
Maybe in VBA?

colTOright = 6
' Create a new Excel workbook
set objXL = WScript.CreateObject("Excel.Application")
objXL.Visible = True
set workbook = objXL.Workbooks.Add
set worksheet = workbook.Worksheets("sheet1")
' worksheet.Range("A1:F1").Select
With Worksheet("Sheet1")
..Range(.Range("A1"), .Range("A1").Offset(colTOright)).Select
End With

I'm just trying to replace the ending cell (F1) with a string or use an
Offset. Didn't think it would be that difficult.

newColumn = .Cells(A1).Offset(colTOright).Value
and replace F1 with newColumn, but that object doesn't except strings.


worksheet.Range("A1:F1").Select

Robert


--
roblo
------------------------------------------------------------------------
roblo's Profile: http://www.excelforum.com/member.php...o&userid=22469
View this thread: http://www.excelforum.com/showthread...hreadid=399231