Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro code question

ActiveCell.Offset(columnoffset:=1).Select
Selection.Copy
ActiveCell.Offset(columnoffset:=-1).Select
ActiveCell.Numberformat = "General"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Application.CutCopyMode = False
Selection.Copy
' Activecell.??? what can I put here to perform what F2 key and enter
does???
ActiveCell.Offset(rowoffset:=1).Select

Should fix it.

if it doesn't then the formula you are pasting may be referring to a cell
formatted as Text. If so, can you change the formatting on that cell?
--
Regards,
Tom Ogilvy

"anderson101" wrote in message
...
I have created a very simple macro to copy the contents of one cell and

paste it in another effectively creating an =If forumla. However, this new
forumla will not "activate?" until I hit the F2 key and hit enter. If
someone can show me the code I can use to automatically perform this
function in any way (F2 then enter), I would be very appreciative! here is
the code I have and the line I am having a problem with:


ActiveCell.Offset(columnoffset:=1).Select
Selection.Copy
ActiveCell.Offset(columnoffset:=-1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,

SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
' Activecell.??? what can I put here to perform what F2 key and enter

does???
ActiveCell.Offset(rowoffset:=1).Select

Thank you!



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro code question

Tom, thank you for your reply. What is happening is that I am creating an =if formula through a series of cell combinations (i.e. combining three cells A1&A2&A3). Then, I'm pasting the value of this combination in a new cell. Of course, it pastes like a value since that is what it is. However, I found that if I hit the F2 key to "edit" the cell and then immediately hit enter, the value realizes it is a formula and calculates accordingly. I was looking for some VB code to automatically perform this F2 and enter process. The purpose is to create a macro that dynamically creates a formula and places the result as desired (by an unsophisticated excel user). Any thoughts?

"Tom Ogilvy" wrote:

ActiveCell.Offset(columnoffset:=1).Select
Selection.Copy
ActiveCell.Offset(columnoffset:=-1).Select
ActiveCell.Numberformat = "General"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Application.CutCopyMode = False
Selection.Copy
' Activecell.??? what can I put here to perform what F2 key and enter
does???
ActiveCell.Offset(rowoffset:=1).Select

Should fix it.

if it doesn't then the formula you are pasting may be referring to a cell
formatted as Text. If so, can you change the formatting on that cell?
--
Regards,
Tom Ogilvy

"anderson101" wrote in message
...
I have created a very simple macro to copy the contents of one cell and

paste it in another effectively creating an =If forumla. However, this new
forumla will not "activate?" until I hit the F2 key and hit enter. If
someone can show me the code I can use to automatically perform this
function in any way (F2 then enter), I would be very appreciative! here is
the code I have and the line I am having a problem with:


ActiveCell.Offset(columnoffset:=1).Select
Selection.Copy
ActiveCell.Offset(columnoffset:=-1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,

SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
' Activecell.??? what can I put here to perform what F2 key and enter

does???
ActiveCell.Offset(rowoffset:=1).Select

Thank you!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro code question

ActiveCell.Offset(columnoffset:=1).Select
Selection.Copy
ActiveCell.Offset(columnoffset:=-1).Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
ActiveCell.formula = ActiveCell.Value
ActiveCell.Offset(rowoffset:=1).Select


--
Regards,
Tom Ogilvy

"anderson101" wrote in message
...
Tom, thank you for your reply. What is happening is that I am creating an

=if formula through a series of cell combinations (i.e. combining three
cells A1&A2&A3). Then, I'm pasting the value of this combination in a new
cell. Of course, it pastes like a value since that is what it is. However,
I found that if I hit the F2 key to "edit" the cell and then immediately hit
enter, the value realizes it is a formula and calculates accordingly. I was
looking for some VB code to automatically perform this F2 and enter process.
The purpose is to create a macro that dynamically creates a formula and
places the result as desired (by an unsophisticated excel user). Any
thoughts?

"Tom Ogilvy" wrote:

ActiveCell.Offset(columnoffset:=1).Select
Selection.Copy
ActiveCell.Offset(columnoffset:=-1).Select
ActiveCell.Numberformat = "General"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Application.CutCopyMode = False
Selection.Copy
' Activecell.??? what can I put here to perform what F2 key and enter
does???
ActiveCell.Offset(rowoffset:=1).Select

Should fix it.

if it doesn't then the formula you are pasting may be referring to a

cell
formatted as Text. If so, can you change the formatting on that cell?
--
Regards,
Tom Ogilvy

"anderson101" wrote in message
...
I have created a very simple macro to copy the contents of one cell

and
paste it in another effectively creating an =If forumla. However, this

new
forumla will not "activate?" until I hit the F2 key and hit enter. If
someone can show me the code I can use to automatically perform this
function in any way (F2 then enter), I would be very appreciative! here

is
the code I have and the line I am having a problem with:


ActiveCell.Offset(columnoffset:=1).Select
Selection.Copy
ActiveCell.Offset(columnoffset:=-1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,

SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
' Activecell.??? what can I put here to perform what F2 key and

enter
does???
ActiveCell.Offset(rowoffset:=1).Select

Thank you!






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
macro code question Maria Excel Discussion (Misc queries) 6 March 7th 09 08:44 AM
vb code question Stan Excel Discussion (Misc queries) 0 April 28th 08 04:43 PM
A macro code question from a novice Richard Excel Discussion (Misc queries) 2 December 24th 07 07:22 PM
VBA Code Question Theresa[_4_] Excel Programming 6 October 16th 03 07:06 PM
Macro Code Question for Newbe DataMan Excel Programming 2 September 22nd 03 07:39 PM


All times are GMT +1. The time now is 08:25 AM.

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"