macros help

hail11

Board Regular
Joined
May 3, 2007
Messages
199
i am currently using this code

Dim x As Long
x = Worksheets("Sheet1").Range("O" & Rows.Count).End(xlUp).Row
If x = 1 And Worksheets("Sheet1").Range("J22") = "" Then x = 0
Worksheets("Sheet1").Range("O" & x + 1) = Range("J22")

however what i need is if a1 = jan then range J21 sheet 1
a1 = Feb then range K21 sheet 1
a1 = (throughout the rest of the months) moving range over by one

thanks in advance
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
59,294
Office Version
  1. 365
Platform
  1. Windows
however what i need is
Do you mean instead of your existing code, or as well as what you have already?

if a1 = jan
Is A1 text "jan" (or "Feb", "Mar", etc) or an actual date?

then range J21 sheet 1
Where is the result to go?

Also, what sheet name is the Activesheet when the code is running?
I note that virtually all your range references are prefixed by a sheet name except
= Range("J22")
Does that indicate that this particular "J22" is not on Sheet1 but in the Activesheet?
 
Upvote 0

hail11

Board Regular
Joined
May 3, 2007
Messages
199
everything will go off of sheet 1 in the same workbook

Question 1: I need to include my code i have because i need thouse numbers in other cells

Question 2:It is text

Question 3: If the a1 = jan then range J21 goes to AA1

Sorry about the confusin hope this helps
 
Upvote 0

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
59,294
Office Version
  1. 365
Platform
  1. Windows
everything will go off of sheet 1 in the same workbook

Question 1: I need to include my code i have because i need thouse numbers in other cells

Question 2:It is text

Question 3: If the a1 = jan then range J21 goes to AA1

Sorry about the confusin hope this helps
Sorry, I still don't fully understand.

What goes where if A1 = Feb ?
What goes where if A1 = Mar ?

Hopefully from that I can get the pattern.
 
Upvote 0

hail11

Board Regular
Joined
May 3, 2007
Messages
199
if a1 = jan then J Colum , if feb then K Colum, if march then L colum so on so all info will fall under the colum if it = that month
 
Upvote 0

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
59,294
Office Version
  1. 365
Platform
  1. Windows
if a1 = jan then J Colum, if feb then K Colum, if march then L colum so on so all info will fall under the colum if it = that month
Does this mean that if A1 = Jan then the J21 value should be put in AA1?
and if A1 = Feb then the K21 value should be put in AA1 etc?

You have to be specific and detailed! Remember that you know what your sheet looks like and what you are trying to do, we don't have either of those luxuries.
 
Upvote 0

Forum statistics

Threads
1,191,087
Messages
5,984,543
Members
439,896
Latest member
SquareCare

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top