Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Convert VBA to well written Excel formula or similar?

Our business process requires that we support Macs and PCs. In light of the
absence of VBA in Office 2008 for Mac, and business reasons that dictate
that AppleScript is not an option, we are doing analysis to see if a native
well written Excel formula or similar could be used in place of our legacy
VBA below. Essentially it is a two step copy and paste process. My gut
tells me that since we want this to occur on a button click event, we are
out of luck.

Could this be rewritten in an Excel formula or similar without using VBA?
Your creative input would be appreciated.

Thanks,
Mark


Dim s1 As String
Dim s2 As String
Dim y1 As Range
Dim y2 As Range
Dim r As Integer

s1 = "P(" & (ActiveSheet.Range("AD2").Value - 1) & ")"
s2 = "P(" & (ActiveSheet.Range("AD2").Value) & ")"

For r = 1 To 12

' general copy and paste...
Set y1 = Worksheets(s1).Range("B1:W1")
Set y1 = y1.Offset((2 * r) + 4, 0)
y1.Copy
Set y2 = Worksheets(s2).Range("B1:W1")
Set y2 = y2.Offset((2 * r) + 4, 0)
y2.PasteSpecial

' copy the adjusted base salary
Set y2 = Worksheets(s2).Range("P1").Offset((2 * r) + 4, 0)
If Not y2.Value = "" Then
Set y1 = Worksheets(s1).Range("P1").Offset((2 * r) + 4, 0)
y2.Value = y1.Value * (1 + Sheets("Cover").Range("G20").Value)
End If

Next r

For r = 1 To 11

' general copy and paste...
Set y1 = Worksheets(s1).Range("B1:W1")
Set y1 = y1.Offset((2 * r) + 32, 0)
y1.Copy
Set y2 = Worksheets(s2).Range("B1:W1")
Set y2 = y2.Offset((2 * r) + 32, 0)
y2.PasteSpecial

' copy the adjusted base salary
Set y2 = Worksheets(s2).Range("P1").Offset((2 * r) + 32, 0)
If Not y2.Value = "" Then
Set y1 = Worksheets(s1).Range("P1").Offset((2 * r) + 32, 0)
y2.Value = y1.Value * (1 + Sheets("Cover").Range("G20").Value)
End If

Next r


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
Need Excel function to convert dollars to written words Joanne Excel Discussion (Misc queries) 2 November 9th 06 05:52 PM
How do I convert Amounts written in figures to words ? Seemika Excel Discussion (Misc queries) 2 August 29th 06 01:12 PM
How do I write a formula to convert numbers to written text? Jess Excel Worksheet Functions 2 April 25th 06 03:25 PM
function to convert whole numbers to written text Mani K Excel Worksheet Functions 2 December 29th 05 09:24 AM
Is there a formula to convert numbers to written text in Excel? LZC Excel Worksheet Functions 3 November 27th 04 08:10 PM


All times are GMT +1. The time now is 11:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"