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


Hi,
Below i have pasted 2 codes, one is worksheet another standard i
wanted to join these two codes and to become a standard code. Any idea
?
thanks and regards
nowfal

-----------------------------------------------------------------------------

Private Sub Worksheet_Change(ByVal Target As Range)
Dim iPos As Long

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Address = "$B$8" Then
If Len(.Value) 62 Then
iPos = InStrRev(.Value, " ", 63)
If iPos 0 Then
..Offset(1, 0).Value = Right(.Value, Len(.Value) - iPos)
..Value = Left(.Value, iPos)
End If
End If
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

-------------------------------------------------------------------------------
GBPREINST Macro
' Macro recorded 18/08/2005 by Musandam
'
Range("B8,B9").ClearContents
Range("B8").Select
Windows("MICR.xls").Activate
Range("N2").Select
Windows("MICR PRINT.xls").Activate
ActiveCell.FormulaR1C1 = "=MICR.xls!R2C14"
Range("B4").Select
Sheets("DA").Select
Range("A9,a10,a11").ClearContents
Range("A9").Select
Windows("MICR PRINT.xls").Activate
ActiveCell.FormulaR1C1 = "=MICR.xls!R2C15"
Range("a10").Select
ActiveCell.FormulaR1C1 = "=SPELLNUMBER(R[-1]C,""GBP"")"
Range("A2").Select
Sheets("GBP").Select
Range("b4").Select
End Sub


--
nowfal
------------------------------------------------------------------------
nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003
View this thread: http://www.excelforum.com/showthread...hreadid=397700

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default joining macro

I may be over-simplifying it, but this triggered by a change in B7 splits
the results from SPELLNUMBER into 2 cells

Private Sub Worksheet_Change(ByVal Target As Range)
Dim iPos As Long

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Address = "$B$7" Then
With .Offset(0, 1)
.Value = SPELLNUMBER(.Value, "GBP")
If Len(.Value) 62 Then
iPos = InStrRev(.Value, " ", 63)
If iPos 0 Then
.Offset(1, 0).Value = Right(.Value, Len(.Value) -
iPos)
.Value = Left(.Value, iPos)
End If
End If
End With
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"nowfal" wrote in
message ...

Hi,
Below i have pasted 2 codes, one is worksheet another standard i
wanted to join these two codes and to become a standard code. Any idea
?
thanks and regards
nowfal

--------------------------------------------------------------------------

---

Private Sub Worksheet_Change(ByVal Target As Range)
Dim iPos As Long

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Address = "$B$8" Then
If Len(.Value) 62 Then
iPos = InStrRev(.Value, " ", 63)
If iPos 0 Then
Offset(1, 0).Value = Right(.Value, Len(.Value) - iPos)
Value = Left(.Value, iPos)
End If
End If
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

--------------------------------------------------------------------------

-----
GBPREINST Macro
' Macro recorded 18/08/2005 by Musandam
'
Range("B8,B9").ClearContents
Range("B8").Select
Windows("MICR.xls").Activate
Range("N2").Select
Windows("MICR PRINT.xls").Activate
ActiveCell.FormulaR1C1 = "=MICR.xls!R2C14"
Range("B4").Select
Sheets("DA").Select
Range("A9,a10,a11").ClearContents
Range("A9").Select
Windows("MICR PRINT.xls").Activate
ActiveCell.FormulaR1C1 = "=MICR.xls!R2C15"
Range("a10").Select
ActiveCell.FormulaR1C1 = "=SPELLNUMBER(R[-1]C,""GBP"")"
Range("A2").Select
Sheets("GBP").Select
Range("b4").Select
End Sub


--
nowfal
------------------------------------------------------------------------
nowfal's Profile:

http://www.excelforum.com/member.php...o&userid=10003
View this thread: http://www.excelforum.com/showthread...hreadid=397700



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
Joining worksheets Khurum Excel Worksheet Functions 3 April 16th 07 03:32 PM
Joining Worksheets Naomi Excel Worksheet Functions 2 July 16th 06 12:18 AM
joining worksheets Brion Excel Worksheet Functions 1 February 3rd 06 02:52 PM
Joining text sungen99[_19_] Excel Programming 2 October 29th 04 08:01 PM
Joining Columns Michael168[_76_] Excel Programming 7 June 1st 04 07:18 AM


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