LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default vbscript to open worksheet, insert data on first opencell....HELP.....

Hi all, I have a script that goes out and searches a spreadsheet for
information. If it finds a null value or errors out, I need my script
to open up
another logging spreadsheet and look into the last cell of Column A,
read what the value is and insert the same value plus 1 (Column A is
and ID #) and then enter the error text into column B.

I have scripted inserted columns, values into cells and such, but I
have no idea how to go about finding the last cell, adding 1 to it in
the next row, then adding text to the new row column B.


'~~~~My script that needs help - Not all of script~~~~~~~~~~
objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Open ("C:\Excelfilename.xls")
Set objSheet = objExcel.ActiveWorkbook.WorkSheets(1)


IntRow = 9
A = 1
K = 11
R = 18


if objExcel.Cells(intRow, K).Value < "VALIDTEXT" then
objExcel.Cells(intRow, R).Interior.ColorIndex = 4
else
objExcel.Visible = False
objExcel.Workbooks.Open("C:\ErrorLog.xls")
objExcel.Cells(A,FIRSTOPENCELL) = (LASTUSEDCELL+1) <=THIS IS
WHERE I NEED HELP=
objExcel.Cells(B,FIRSTOPENCELL) = "ERRORTEXT"
End If

So basically, I'm opening a spreadsheet, looking in Column A for the
last value, adding 1 to that value and entering that on the next
available row, then on that same open row, I want to also place a text
value in Column B)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wish to add a WORKSHEET but 'WORKSHEET' not open in 'INSERT' Zona Excel Worksheet Functions 1 September 6th 06 03:52 AM
Delete Insert Worksheet on Open/Reset on Close Jane Excel Programming 1 April 10th 06 02:08 PM
Save and Close all Open Workbooks using VBScript Rick De Marco Excel Programming 1 November 18th 04 07:08 AM
Catching an Open Excel File with VBScript onedaywhen Excel Programming 2 April 6th 04 09:54 AM
open Excel workbook using vbscript Tom Ogilvy Excel Programming 0 September 16th 03 04:38 PM


All times are GMT +1. The time now is 08:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"