Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default active cell control using scripts


Hello all,

I found a script for my excel form and basically what it does is
searches for the next available blank row and adds a record or whatever
I entered in the form.

As of now the script does a search on A1(col). Range(A1) and it
keeps going down until it finds a free cell in col A. so the first col
would be 1,0, sec col would be 1,1, third would be 1,2 and so forth.

What I need to do is do a search on col B and start the input from col
a (0,0) col b(1,1) col c(0,2) and soo forth.
Problem when I change the second line to B1 it doesnt see col A as
(0,0) rather the (0,0) starts from col b.
Im somewhat new to this but played with the cols but I cant get it to
start from col A.
Any ideas?
copy/pasted part of the code for your view:

ActiveWorkbook.Sheets("doctors").Activate
Range("B1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True

ActiveCell.Value = info_external_id.Value

If option_physician = True Then
ActiveCell.Offset(0, 1).Value = "Y"
ElseIf option_referrals = True Then
ActiveCell.Offset(0, 14).Value = "Y"
End If

ActiveCell.Offset(0, 2) = info_external_id.Value
ActiveCell.Offset(0, 3) = info_last_name.Value


--
Robin01
------------------------------------------------------------------------
Robin01's Profile: http://www.excelforum.com/member.php...o&userid=35269
View this thread: http://www.excelforum.com/showthread...hreadid=562586

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default active cell control using scripts

Robin,

Your active cell is in column B. To access column A via the
"ActiveCell.Offset" property you need to use a -1 for the column reference.
(ie. ActiveCell.Offset(0,-1))

You could also use the cells property instead of offset. Cells(1,1) is
"A1", Cells(4,10) is "D10".

For a better understanding of the Offset property - in your VBA editor click
Help-Microsoft Visual Basic Help and type "Offset Property" - the first
entry should be the one you want to look at.

Mike

"Robin01" wrote:


Hello all,

I found a script for my excel form and basically what it does is
searches for the next available blank row and adds a record or whatever
I entered in the form.

As of now the script does a search on A1(col). Range(A1) and it
keeps going down until it finds a free cell in col A. so the first col
would be 1,0, sec col would be 1,1, third would be 1,2 and so forth.

What I need to do is do a search on col B and start the input from col
a (0,0) col b(1,1) col c(0,2) and soo forth.
Problem when I change the second line to B1 it doesnt see col A as
(0,0) rather the (0,0) starts from col b.
Im somewhat new to this but played with the cols but I cant get it to
start from col A.
Any ideas?
copy/pasted part of the code for your view:

ActiveWorkbook.Sheets("doctors").Activate
Range("B1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True

ActiveCell.Value = info_external_id.Value

If option_physician = True Then
ActiveCell.Offset(0, 1).Value = "Y"
ElseIf option_referrals = True Then
ActiveCell.Offset(0, 14).Value = "Y"
End If

ActiveCell.Offset(0, 2) = info_external_id.Value
ActiveCell.Offset(0, 3) = info_last_name.Value


--
Robin01
------------------------------------------------------------------------
Robin01's Profile: http://www.excelforum.com/member.php...o&userid=35269
View this thread: http://www.excelforum.com/showthread...hreadid=562586


Reply
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
Populate Cell Date Value with Active X Calendar Control Jim Lawrence Excel Worksheet Functions 1 February 13th 09 04:20 PM
Difference between a Forms Control verus Active-X Control funGT350 Excel Discussion (Misc queries) 6 May 6th 08 11:20 PM
how to set active x control sharlie Excel Discussion (Misc queries) 0 March 30th 06 01:27 AM
Adding a control button to insert a date in the active cell. Mike Excel Discussion (Misc queries) 2 February 15th 05 06:27 PM
Tool Tip Text for Form control/ Active-X control Freddie[_2_] Excel Programming 0 October 19th 04 04:14 AM


All times are GMT +1. The time now is 05:59 PM.

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

About Us

"It's about Microsoft Excel"