Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Can't call macro from another

Hi All. I have the following code for a UserForm. It copies a list of dropped
golfers, goes to another part of the spreadsheet and finds the 1st empty cell
in the column, pastes it and then moves 1 cell to the right and enters the
date. All that works fine. The problem is that after it completes that it
doesn't go to macro "DropButtonContinue". It loops again. Can anyone tell me
what I am missing?

Private Sub DropButton_Click()
Range("DROPS").Select
Selection.Copy
strDrops = Range("TEAMDROPS").Value
Range(strDrops).Select
For DropsCounter = 1 To 100
If ActiveCell.Value = "" Then
Selection.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Date
DropButtonContinue
Else
ActiveCell.Offset(1, 0).Select
End If
Next DropsCounter
End Sub

Private Sub DropButtonContinue()
<<<More Code Here

Thanks for any help.
--
Jim T
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default Can't call macro from another

Substitute the Cell references to the first row and column where the data is
to be pasted and try this.

Private Sub DropButton_Click()
With cells
Range("DROPS").Select
Selection.Copy
strDrops = Range("TEAMDROPS").Value
Range(strDrops).Select
set rng = .Range(.Cells(1,1),.cells(1,1)).End (xlDown)
rng.Offset(1,0).Activate
Activecell.PasteSpecial
End With

DropButtonContinue
End Sub

--
Best wishes,

Jim


"Jim Tibbetts" wrote:

Hi All. I have the following code for a UserForm. It copies a list of dropped
golfers, goes to another part of the spreadsheet and finds the 1st empty cell
in the column, pastes it and then moves 1 cell to the right and enters the
date. All that works fine. The problem is that after it completes that it
doesn't go to macro "DropButtonContinue". It loops again. Can anyone tell me
what I am missing?

Private Sub DropButton_Click()
Range("DROPS").Select
Selection.Copy
strDrops = Range("TEAMDROPS").Value
Range(strDrops).Select
For DropsCounter = 1 To 100
If ActiveCell.Value = "" Then
Selection.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Date
DropButtonContinue
Else
ActiveCell.Offset(1, 0).Select
End If
Next DropsCounter
End Sub

Private Sub DropButtonContinue()
<<<More Code Here

Thanks for any help.
--
Jim T

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default Can't call macro from another

I forgot to add this line
Dim rng As Range

--
Best wishes,

Jim


"Jim Tibbetts" wrote:

Hi All. I have the following code for a UserForm. It copies a list of dropped
golfers, goes to another part of the spreadsheet and finds the 1st empty cell
in the column, pastes it and then moves 1 cell to the right and enters the
date. All that works fine. The problem is that after it completes that it
doesn't go to macro "DropButtonContinue". It loops again. Can anyone tell me
what I am missing?

Private Sub DropButton_Click()
Range("DROPS").Select
Selection.Copy
strDrops = Range("TEAMDROPS").Value
Range(strDrops).Select
For DropsCounter = 1 To 100
If ActiveCell.Value = "" Then
Selection.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Date
DropButtonContinue
Else
ActiveCell.Offset(1, 0).Select
End If
Next DropsCounter
End Sub

Private Sub DropButtonContinue()
<<<More Code Here

Thanks for any help.
--
Jim T

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Can't call macro from another

Jim - Thanks for helping me with my problem. Your suggested code called for
the range to be set starting in A1, and you told me to replace that with the
cell reference where the DROPS are to be pasted. Unfortunately, the value of
TEAMDROPS is the result of a formula based on a selection from a ComboBox and
changes each time the ComboBox is clicked. Therefore, the range referenced
changes also. Also, the first time TEAMDROPS is accessed (where ever it is)
it is empty. That was one of the reasons I was wrapping it all in an IF
statement. Any ideas on what to do now?
--
Jim T


"Jim Jackson" wrote:

I forgot to add this line
Dim rng As Range

--
Best wishes,

Jim


"Jim Tibbetts" wrote:

Hi All. I have the following code for a UserForm. It copies a list of dropped
golfers, goes to another part of the spreadsheet and finds the 1st empty cell
in the column, pastes it and then moves 1 cell to the right and enters the
date. All that works fine. The problem is that after it completes that it
doesn't go to macro "DropButtonContinue". It loops again. Can anyone tell me
what I am missing?

Private Sub DropButton_Click()
Range("DROPS").Select
Selection.Copy
strDrops = Range("TEAMDROPS").Value
Range(strDrops).Select
For DropsCounter = 1 To 100
If ActiveCell.Value = "" Then
Selection.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Date
DropButtonContinue
Else
ActiveCell.Offset(1, 0).Select
End If
Next DropsCounter
End Sub

Private Sub DropButtonContinue()
<<<More Code Here

Thanks for any help.
--
Jim T

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default Can't call macro from another

Does this do what you need?

Private Sub DropButton_Click()
With cells
Range("DROPS").Select
Selection.Copy
strDrops = Range("TEAMDROPS").Value
Range(strDrops).Select
If Activecell = "" then
Activecell.pastespecial
elseIf activecell.Offset(1,0) < "" then
set rng = .Range(.Cells(1,1),.cells(1,1)).End (xlDown)
rng.Offset(1,0).Activate
Activecell.PasteSpecial
Else
Activecell.Offset(1,0).Activate
Activecell.pasteSpecial
end if
End With

DropButtonContinue
End Sub

--
Best wishes,

Jim


"Jim Jackson" wrote:

Substitute the Cell references to the first row and column where the data is
to be pasted and try this.

Private Sub DropButton_Click()
With cells
Range("DROPS").Select
Selection.Copy
strDrops = Range("TEAMDROPS").Value
Range(strDrops).Select
set rng = .Range(.Cells(1,1),.cells(1,1)).End (xlDown)
rng.Offset(1,0).Activate
Activecell.PasteSpecial
End With

DropButtonContinue
End Sub

--
Best wishes,

Jim


"Jim Tibbetts" wrote:

Hi All. I have the following code for a UserForm. It copies a list of dropped
golfers, goes to another part of the spreadsheet and finds the 1st empty cell
in the column, pastes it and then moves 1 cell to the right and enters the
date. All that works fine. The problem is that after it completes that it
doesn't go to macro "DropButtonContinue". It loops again. Can anyone tell me
what I am missing?

Private Sub DropButton_Click()
Range("DROPS").Select
Selection.Copy
strDrops = Range("TEAMDROPS").Value
Range(strDrops).Select
For DropsCounter = 1 To 100
If ActiveCell.Value = "" Then
Selection.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Date
DropButtonContinue
Else
ActiveCell.Offset(1, 0).Select
End If
Next DropsCounter
End Sub

Private Sub DropButtonContinue()
<<<More Code Here

Thanks for any help.
--
Jim T

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
Call Macro jswalsh33 Excel Discussion (Misc queries) 2 February 21st 10 10:38 AM
How can run a macro ( call a macro) on selection of any filtercriteria? [email protected] Excel Worksheet Functions 7 February 20th 09 12:34 AM
Call an Access macro from an Excel macro Jason W Excel Discussion (Misc queries) 1 May 1st 08 08:33 PM
Excel Macro call Word Macro with Parameters Bill Sturdevant[_2_] Excel Programming 9 May 24th 07 12:21 AM
Call macro stored in Excel workbook from Outlook's macro Gvaram Excel Programming 0 October 4th 06 05:47 PM


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