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 VBA column counts


Hi I'm new here, and very new to VBA. Im am writing a macro to
automatically get information from gauges connected via rs232c with
help from a excel add-in that provides worksheet functions to allow the
gauges to be read. My problem is that i need to get the column letter
from a column count, then write this letter to a cell. You can see
below where i have commented what variable holds the column count and
where i'd like it put. Any help would be much appreciated.


Code:
--------------------
Sub Oedometer()

' defines loads on each oedometer
str_loada = InputBox(Prompt:="Enter Loading for Oedometer A(kPa)", Title:="Load Amount")
str_loadb = InputBox(Prompt:="Enter Loading for Oedometer B(kPa)", Title:="Load Amount")

' sets up sheet for oedometer A
Sheets("Sheet1").Select
i_colcounta = ActiveSheet.UsedRange.Columns.Count
i_cola = i_colcounta + 1
Cells(1, i_cola).Value = str_loada

' sets up sheet for oedometer B
Sheets("Sheet2").Select
i_colcountb = ActiveSheet.UsedRange.Columns.Count
i_colb = i_colcountb + 1
Cells(1, i_colb).Value = str_loadb

MsgBox "Click OK to begin data collection."

' collect data
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 10 ' time interval
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

Sheets("Sheet3").Select
Range("B3").Select
ActiveCell.Value = i_cola ' place column letter here
Range("A2:A6").Select
Application.Run Macro:="Easy_Macro"


End Sub
--------------------





--
almonde
------------------------------------------------------------------------
almonde's Profile: http://www.excelforum.com/member.php...o&userid=25257
View this thread: http://www.excelforum.com/showthread...hreadid=387480

 
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
For FARAZ QURESHI - Column Entry Counts JLatham Excel Discussion (Misc queries) 0 December 24th 08 12:49 PM
average daily counts to weekly counts Dave Excel Discussion (Misc queries) 0 June 17th 08 06:24 PM
Column Counts Brurobiney Excel Discussion (Misc queries) 1 March 15th 07 09:07 PM
Looking for a Function which counts the repeatition of text in a column [email protected] Excel Worksheet Functions 1 February 16th 06 03:41 PM
Counts Ange[_3_] Excel Programming 1 August 17th 04 07:08 PM


All times are GMT +1. The time now is 05:34 AM.

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"