Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default VBA Variables....

I am still having problems with my varaibles. Below is the code i have
written, can anybody offer any help as to why it is not working?

Dim BottomRow As Range
Set BottomRow = ActiveCell

Range("a2").Select
Dim Beginning As Range
Set Beginning = ActiveCell

Selection.AutoFill Destination:=Range(Beginning, BottomRow.Offset(0,
-1)), Type:=xlFillDefault

Many Thanks,
Mark

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default VBA Variables....

Mark,

It worked for me. What are you getting?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"MarkHear1" wrote in message
oups.com...
I am still having problems with my varaibles. Below is the code i have
written, can anybody offer any help as to why it is not working?

Dim BottomRow As Range
Set BottomRow = ActiveCell

Range("a2").Select
Dim Beginning As Range
Set Beginning = ActiveCell

Selection.AutoFill Destination:=Range(Beginning, BottomRow.Offset(0,
-1)), Type:=xlFillDefault

Many Thanks,
Mark



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default VBA Variables....

On 15 Feb, 12:23, "Bob Phillips" wrote:
Mark,

It worked for me. What are you getting?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"MarkHear1" wrote in message

oups.com...



I am still having problems with my varaibles. Below is the code i have
written, can anybody offer any help as to why it is not working?


Dim BottomRow As Range
Set BottomRow = ActiveCell


Range("a2").Select
Dim Beginning As Range
Set Beginning = ActiveCell


Selection.AutoFill Destination:=Range(Beginning, BottomRow.Offset(0,
-1)), Type:=xlFillDefault


Many Thanks,
Mark- Hide quoted text -


- Show quoted text -


Hummmmmm very odd. The error I am getting is as follows...
Run-Time error '1004':
AutoFill method of Range class failed.


- Mark

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default VBA Variables....

What is the data you are trying to fill-down?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"MarkHear1" wrote in message
oups.com...
On 15 Feb, 12:23, "Bob Phillips" wrote:
Mark,

It worked for me. What are you getting?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"MarkHear1" wrote in message

oups.com...



I am still having problems with my varaibles. Below is the code i have
written, can anybody offer any help as to why it is not working?


Dim BottomRow As Range
Set BottomRow = ActiveCell


Range("a2").Select
Dim Beginning As Range
Set Beginning = ActiveCell


Selection.AutoFill Destination:=Range(Beginning, BottomRow.Offset(0,
-1)), Type:=xlFillDefault


Many Thanks,
Mark- Hide quoted text -


- Show quoted text -


Hummmmmm very odd. The error I am getting is as follows...
Run-Time error '1004':
AutoFill method of Range class failed.


- Mark



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default VBA Variables....

On 15 Feb, 13:08, "Bob Phillips" wrote:
What is the data you are trying to fill-down?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"MarkHear1" wrote in message

oups.com...



On 15 Feb, 12:23, "Bob Phillips" wrote:
Mark,


It worked for me. What are you getting?


--
---
HTH


Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)


"MarkHear1" wrote in message


groups.com...


I am still having problems with my varaibles. Below is the code i have
written, can anybody offer any help as to why it is not working?


Dim BottomRow As Range
Set BottomRow = ActiveCell


Range("a2").Select
Dim Beginning As Range
Set Beginning = ActiveCell


Selection.AutoFill Destination:=Range(Beginning, BottomRow.Offset(0,
-1)), Type:=xlFillDefault


Many Thanks,
Mark- Hide quoted text -


- Show quoted text -


Hummmmmm very odd. The error I am getting is as follows...
Run-Time error '1004':
AutoFill method of Range class failed.


- Mark- Hide quoted text -


- Show quoted text -


It's a formula ...
Range("a2").Value = "=VLOOKUP(B2,'download.csv'!$A$2:$J$5000,10,0) "

- mark



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default VBA Variables....

Your problem appears to be that you are trying to offset a1 -1 column.

Try this to fill down from a2 to the activecell in column A

Sub filldowntoactivecell()
range("a2:a"&activecell.Row).filldown
End Sub


--
Don Guillett
SalesAid Software

"MarkHear1" wrote in message
oups.com...
I am still having problems with my varaibles. Below is the code i have
written, can anybody offer any help as to why it is not working?

Dim BottomRow As Range
Set BottomRow = ActiveCell

Range("a2").Select
Dim Beginning As Range
Set Beginning = ActiveCell

Selection.AutoFill Destination:=Range(Beginning, BottomRow.Offset(0,
-1)), Type:=xlFillDefault

Many Thanks,
Mark



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default VBA Variables....

On 15 Feb, 13:46, "Don Guillett" wrote:
Your problem appears to be that you are trying to offset a1 -1 column.

Try this to fill down from a2 to the activecell in column A

Sub filldowntoactivecell()
range("a2:a"&activecell.Row).filldown
End Sub

--
Don Guillett
SalesAid Software
"MarkHear1" wrote in message

oups.com...



I am still having problems with my varaibles. Below is the code i have
written, can anybody offer any help as to why it is not working?


Dim BottomRow As Range
Set BottomRow = ActiveCell


Range("a2").Select
Dim Beginning As Range
Set Beginning = ActiveCell


Selection.AutoFill Destination:=Range(Beginning, BottomRow.Offset(0,
-1)), Type:=xlFillDefault


Many Thanks,
Mark- Hide quoted text -


- Show quoted text -


I tested that code, and it doesn't copy the value in a2 down - do you
have any other suggestions?

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default VBA Variables....

On 15 Feb, 14:11, "Don Guillett" wrote:
I also tested before I sent and it does copy a2 down to the ACTIVECELL row.
So, if you select row 10 in ANY column it will copy a2 down to a10.
--
Don Guillett
SalesAid Software
"MarkHear1" wrote in message

oups.com...



On 15 Feb, 13:46, "Don Guillett" wrote:
Your problem appears to be that you are trying to offset a1 -1 column.


Try this to fill down from a2 to the activecell in column A


Sub filldowntoactivecell()
range("a2:a"&activecell.Row).filldown
End Sub


--
Don Guillett
SalesAid Software
"MarkHear1" wrote in
message


groups.com...


I am still having problems with my varaibles. Below is the code i have
written, can anybody offer any help as to why it is not working?


Dim BottomRow As Range
Set BottomRow = ActiveCell


Range("a2").Select
Dim Beginning As Range
Set Beginning = ActiveCell


Selection.AutoFill Destination:=Range(Beginning, BottomRow.Offset(0,
-1)), Type:=xlFillDefault


Many Thanks,
Mark- Hide quoted text -


- Show quoted text -


I tested that code, and it doesn't copy the value in a2 down - do you
have any other suggestions?- Hide quoted text -


- Show quoted text -


My apologies - i just retested this and it does work however, on my
spreadsheet i have got an autofilter set up, and when this is
configured as it needs to be cell a2 is not visible, and this prevents
the code from working...

  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default VBA Variables....

On 15 Feb, 14:19, "Don Guillett" wrote:
It appears that you want to copy down to the last row in col B so I would
use

Sub filldowntoactivecell()
lrinB=cells(rows.count,"b").end(xlup).row
range("a2:a"&lrinB).filldown
End Sub

--
Don Guillett
SalesAid Software
"Don Guillett" wrote in message

...





I also tested before I sent and it does copy a2 down to the ACTIVECELL
row. So, if you select row 10 in ANY column it will copy a2 down to a10.
--
Don Guillett
SalesAid Software

"MarkHear1" wrote in message
roups.com...
On 15 Feb, 13:46, "Don Guillett" wrote:
Your problem appears to be that you are trying to offset a1 -1 column.


Try this to fill down from a2 to the activecell in column A


Sub filldowntoactivecell()
range("a2:a"&activecell.Row).filldown
End Sub


--
Don Guillett
SalesAid Software
"MarkHear1" wrote in
message


egroups.com...


I am still having problems with my varaibles. Below is the code i have
written, can anybody offer any help as to why it is not working?


Dim BottomRow As Range
Set BottomRow = ActiveCell


Range("a2").Select
Dim Beginning As Range
Set Beginning = ActiveCell


Selection.AutoFill Destination:=Range(Beginning, BottomRow.Offset(0,
-1)), Type:=xlFillDefault


Many Thanks,
Mark- Hide quoted text -


- Show quoted text -


I tested that code, and it doesn't copy the value in a2 down - do you
have any other suggestions?- Hide quoted text -


- Show quoted text -


That's correct.
And that code works a treat.
Thank you very much for your help.

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default VBA Variables....

Where's the activecell when you start this procedure?

Maybe...

Set BottomRow = ActiveCell.entirerow.cells(1) 'column A
Set Beginning = range("a2")

Beginning.autofill _
Destination:=Range(Beginning, BottomRow)), Type:=xlFillDefault

=====
Another option:

Range("a2:a" & activecell.row).formula _
= "=VLOOKUP(B2,'download.csv'!$A$2:$J$5000,10,0) "



MarkHear1 wrote:

I am still having problems with my varaibles. Below is the code i have
written, can anybody offer any help as to why it is not working?

Dim BottomRow As Range
Set BottomRow = ActiveCell

Range("a2").Select
Dim Beginning As Range
Set Beginning = ActiveCell

Selection.AutoFill Destination:=Range(Beginning, BottomRow.Offset(0,
-1)), Type:=xlFillDefault

Many Thanks,
Mark


--

Dave Peterson
  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default VBA Variables....

Glad you got it sorted out.

--
Don Guillett
SalesAid Software

"MarkHear1" wrote in message
oups.com...
On 15 Feb, 14:19, "Don Guillett" wrote:
It appears that you want to copy down to the last row in col B so I would
use

Sub filldowntoactivecell()
lrinB=cells(rows.count,"b").end(xlup).row
range("a2:a"&lrinB).filldown
End Sub

--
Don Guillett
SalesAid Software
"Don Guillett" wrote
in message

...





I also tested before I sent and it does copy a2 down to the ACTIVECELL
row. So, if you select row 10 in ANY column it will copy a2 down to
a10.
--
Don Guillett
SalesAid Software

"MarkHear1" wrote in message
roups.com...
On 15 Feb, 13:46, "Don Guillett" wrote:
Your problem appears to be that you are trying to offset a1 -1
column.


Try this to fill down from a2 to the activecell in column A


Sub filldowntoactivecell()
range("a2:a"&activecell.Row).filldown
End Sub


--
Don Guillett
SalesAid Software
"MarkHear1" wrote in
message


egroups.com...


I am still having problems with my varaibles. Below is the code i
have
written, can anybody offer any help as to why it is not working?


Dim BottomRow As Range
Set BottomRow = ActiveCell


Range("a2").Select
Dim Beginning As Range
Set Beginning = ActiveCell


Selection.AutoFill Destination:=Range(Beginning,
BottomRow.Offset(0,
-1)), Type:=xlFillDefault


Many Thanks,
Mark- Hide quoted text -


- Show quoted text -


I tested that code, and it doesn't copy the value in a2 down - do you
have any other suggestions?- Hide quoted text -


- Show quoted text -


That's correct.
And that code works a treat.
Thank you very much for your help.



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
Not at all clear on use of variables and/or object variables JMay-Rke Excel Discussion (Misc queries) 11 July 4th 08 06:36 PM
Variables Mike Excel Programming 1 November 25th 05 06:59 PM
SUM IF and two variables Leigh Ann Excel Worksheet Functions 6 May 25th 05 03:24 AM
Variables richie Excel Programming 1 October 16th 03 06:44 PM
variables jim c. Excel Programming 1 October 16th 03 01:31 PM


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