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: 5
Default Storing column references in a variable

Hello all,

I'm trying to store column references in a variable as an interger. I want
to store it as an interger so I can perform calculations on it and recall it
to refer to a column or multiple columns.

When I run my code, I get the error message "Run-time error '1004':
Application-defined or object-defined error". It looks like it is because
I'm trying to refer to columns as intergers and it wants letters.

Here is some of my code:

Sub Macro5()
'
' Macro5 Macro
' Macro recorded 6/22/2005 by
'

Dim intLastCol As Integer

Cells.Select
Cells.EntireColumn.AutoFit

Range("A1").Select
Cells.Find(What:="Balance", After:=ActiveCell, LookIn:=xlFormulas,
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=True, SearchFormat:=False).Activate
intLastCol = ActiveCell.Column + 1
Columns(intLastCol & ":" & intLastCol + 6).Select
'Rows (intLastRow + 1 & ":" & intLastRow + 4).Select
Selection.EntireColumn.Delete

Range(intLastCol + 1 & "1").Select
Selection.End(xlDown).Select
If ActiveCell.Row < 65536 Then
MsgBox "Still Data in this column. Please delete more columns.",
vbOKOnly, "Error!!!!!!!!"
Exit Sub
End If




I get the error message at "Columns(intLastCol & ":" & intLastCol +
6).Select". The commented line below it is a working one from another
module that I have there for reference.

Is there any way I can make this work the way I want to?

Thanks in advance for any help anyone can provide,

Conan Kelly


 
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
Storing a value to variable CLamar Excel Discussion (Misc queries) 0 June 16th 06 04:46 PM
Variable Column references Gidders Excel Worksheet Functions 1 July 15th 05 07:54 PM
Storing variable in Option.Tag augustus Excel Programming 0 February 4th 05 02:45 AM
Storing a range in a variable Mick[_8_] Excel Programming 6 January 15th 05 09:36 PM
Storing value in a variable from a cell Saadi Excel Programming 6 January 8th 05 01:27 PM


All times are GMT +1. The time now is 05:21 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"