Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Populating a cell with the current value of a variable

Hi - I'm having problems populating a cell with the current value of a
variable. Basically, I'm trying to do the following:

- set the variable to the value within a specific cell
- paste over a section of a the sheet which inlcudes the cell which was used
to set the variable value in the steop above with blank/null cells
- populate the original cell used to set the variable value with the
variable value

Below is the code I have written which is not working:

Sub clearcontent()

Dim testvalue

Sheets("Frequency Input").Select
range("J2").Select
Set testvalue = Selection

Sheets("Header").Visible = True
Sheets("Header").Select
range("A:G").Select
Selection.Copy
Sheets("Frequency Input").Select
range("J:P").Select
ActiveSheet.Paste

range("J2").Select
Selection = testvalue

Sheets("Header").Select
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.Visible = False

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Populating a cell with the current value of a variable

Sub clearcontent()
Dim testvalue

testvalue = Sheets("Frequency Input").Range("J2").Value

Worksheets("Header").Range("A:G").Copy Destination:= _
Worksheets("Frequency Input").Range("J:P")

Range("J2").Value = testvalue

Application.CutCopyMode = False

End Sub


--
HTH

Bob Phillips

"Linking to specific cells in pivot table"
crosoft.com wrote in
message ...
Hi - I'm having problems populating a cell with the current value of a
variable. Basically, I'm trying to do the following:

- set the variable to the value within a specific cell
- paste over a section of a the sheet which inlcudes the cell which was

used
to set the variable value in the steop above with blank/null cells
- populate the original cell used to set the variable value with the
variable value

Below is the code I have written which is not working:

Sub clearcontent()

Dim testvalue

Sheets("Frequency Input").Select
range("J2").Select
Set testvalue = Selection

Sheets("Header").Visible = True
Sheets("Header").Select
range("A:G").Select
Selection.Copy
Sheets("Frequency Input").Select
range("J:P").Select
ActiveSheet.Paste

range("J2").Select
Selection = testvalue

Sheets("Header").Select
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.Visible = False

End Sub



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
auto populating a cell based on another cell for an invoice Chrisinct Excel Discussion (Misc queries) 3 November 8th 07 06:08 PM
Populating Last Saved Date in Cell AND also update that same cell in Header o0o_Bigs_o0o Excel Discussion (Misc queries) 2 July 4th 06 12:56 PM
Populating a summary of variable size. shakey1181 Excel Discussion (Misc queries) 0 June 22nd 06 03:47 PM
variable = current cell in VB Tim Excel Programming 5 February 24th 04 03:17 PM
Syntax to define a variable for current file Mervyn Thomas Excel Programming 2 December 22nd 03 06:01 PM


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